Run specs without acceptance

55 views
Skip to first unread message

Daniel Lopes

unread,
Jan 20, 2011, 10:23:06 AM1/20/11
to Steak
Today we have rake spec:acceptance or rake spec. Most of the times I
want to run all my model/helper/controller specs without the
acceptance because acceptance is slower than the others. But I can't
found a good way to this without develop my own. Maybe it could be
shiped with Steak.

What do you guys think about a rake task to run the specs without the
acceptance? Or maybe exlude acceptance from the default rake spec.

Thanks

Paco Guzmán

unread,
Jan 20, 2011, 4:13:42 PM1/20/11
to ste...@googlegroups.com
Maybe you could add the following rake task to your project:

spec_prereq = Rails.configuration.generators.options[:rails][:orm] == :active_record ? "db:test:prepare" : :noop

patterns    = [:requests, :models, :controllers, :views, :helpers, :mailers, :lib, :routing]
namespace :spec do
  desc "Run the code examples not in spec/acceptance"
  RSpec::Core::RakeTask.new("no_acceptance" => spec_prereq) do |t|
    t.pattern = patterns.map { |sub| "./spec/#{sub}/**/*_spec.rb" }
  end
end

And run:

rake spec:no_acceptance
--
Paco Guzmán
e-mail: pacog...@gmail.com
blog: pacoguzman.lacoctelera.net/

Daniel Lopes

unread,
Jan 21, 2011, 6:12:40 AM1/21/11
to ste...@googlegroups.com
Thanks Paco, it's very similar to what I started to do. Don't you think that something like this could be packaged inside Steak?

Paco Guzmán

unread,
Jan 21, 2011, 7:24:39 AM1/21/11
to ste...@googlegroups.com
Daniel,

Maybe If we could exclude the acceptance directory, Steak not have to know about which directories rspec-rails use. Anyway is too easy too create this task
Reply all
Reply to author
Forward
0 new messages