Hi,
Is it possible to make a rake task to run examples with a certain
filter on? In this case I want to run rake spec:focused and run only
the examples with :focus => true.
- Toni
Hi,
Is it possible to make a rake task to run examples with a certain
filter on? In this case I want to run rake spec:focused and run only
the examples with :focus => true.
On Nov 3, 2010, at 1:08 AM, Toni T. wrote:
Hi,
Is it possible to make a rake task to run examples with a certain
filter on? In this case I want to run rake spec:focused and run only
the examples with :focus => true.
Not yet. Right now (2.0.1) the only way to define filters is in an
RSpec.configure block. I do it like the first example on
http://relishapp.com/rspec/rspec-core/v/2-0/dir/filtering/run-all-when-everything-filtered.
If there are any examples or groups with “:focus => true”, only those
get run. If there are not, then everything gets run.
There is an open issue/pull request to add command line support for
“tags” similar to that in Cucumber. So if you have:
describe “foo”, :fast => true do
it(“does something”){ … }
end
Then you can do this on the command line:
rspec spec --tags fast
I’m planning to include this in the next minor release (2.1.0). Once
that’s in place you can set up rake tasks like this:
RSpec::Core::RakeTask.new(:fast) do |t|
t.rspec_options = “–tags fast”
end
Take a look at the pull request
(Support for tags on CLI by lailsonbm · Pull Request #205 · rspec/rspec-core · GitHub) to see all the options
that will be available once this in place. It’s going to be pretty
powerful.
Cheers,
David
Ok, thanks. That functionality is enough for me for now at least.
LAILSON BANDEIRA
http://lailsonbandeira.com/
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs