On Thursday, January 2, 2014 7:36:47 AM UTC-8, Andrea Reginato wrote: > > Hi everyone, > > i was wondering if there is or if anyone could find useful the usage of > code based sulutions to run a single test. Let me explain. > > Using Guard and Spork (or Spring) when write some specs, all the specs > in a specific file are executed. Some times, I've different tests on a > single > file and it takes several seconds. I find my self commenting the tests that > passes and I leave the new ones uncommented. > > It works, but it's not productive. I know I can run a specific test frome > the > command line using the -e option, but this is not the solution I need, as > far > as I use Spork and the load time is pretty long. > > I really love the approach taken from Jasmine and Mocha in the JS world. > For example, using Jasmine, if I change it to iit, I'll run only one test. > Here > a more complete description > > JASMINE MOCHA > Focus on a single test change it to iit change it to > it.only > Skip a test change it to xit change > it to it.skip > Focus on a describe block change describe to ddescribe change > describe to describe.only > Skip a describe block change describe to xdescribe change > describe to describe.skip > > My queston is: do you know any solution which can be used in Rspec to > simulate this behaviour. I couldn't find it. > > Thanks a lot. >
You can configure RSpec to run only examples tagged with a specific key, such as `:focus`: https://www.relishapp.com/rspec/rspec-core/v/2-14/docs/filtering/inclusion-filters In addition, RSpec 2.14+ has `fit` as an alias for `it "...", :focus => true`: https://github.com/rspec/rspec-core/pull/955 There's also `xit`, which makes an example temporarily pending: https://relishapp.com/rspec/rspec-core/v/2-14/docs/pending/pending-examples#temporarily-pending-by-prefixing-`it`,-`specify`,-or-`example`-with-an-x At the example group level, there are not yet shortcuts like `xdescribe` or `fdescribe`, but they're planned for RSpec 3: https://github.com/rspec/rspec-core/pull/1236#discussion_r8606837 HTH, Myron -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/909d0c5a-1563-404c-8648-e6db9bae76f9%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
