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
On Nov 3, 2010, at 1:08 AM, Toni Tuominen 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 (https://github.com/rspec/rspec-core/pull/205) 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. - Toni On Wed, Nov 3, 2010 at 2:40 PM, David Chelimsky <dchelimsky at gmail.com> wrote:> On Nov 3, 2010, at 1:08 AM, Toni Tuominen 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 (https://github.com/rspec/rspec-core/pull/205) to see all the options that will be available once this in place. It''s going to be pretty powerful. > > Cheers, > David > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Humm, I did not know about the run_all_when_everything_filtered option. It''s very useful for me? -- LAILSON BANDEIRA http://lailsonbandeira.com/ On Wed, Nov 3, 2010 at 11:12 AM, Toni Tuominen <tjtuom at utu.fi> wrote:> Ok, thanks. That functionality is enough for me for now at least. > > - Toni > > On Wed, Nov 3, 2010 at 2:40 PM, David Chelimsky <dchelimsky at gmail.com> > wrote: > > On Nov 3, 2010, at 1:08 AM, Toni Tuominen 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 ( > https://github.com/rspec/rspec-core/pull/205) to see all the options that > will be available once this in place. It''s going to be pretty powerful. > > > > Cheers, > > David > > > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20101103/f46f53c1/attachment.html>