Andrew Vargo
2011-Feb-16 14:34 UTC
[rspec-users] it_behaves_like and running single examples
Hello, I am running rspec 2 and rails 3 in a project. When I have a shared example being used in a spec file, I loose the ability to run a single test in that file. rspec spec/controllers/proposals_controller_spec.rb:13 for instance will always give me a green ''..'', even if I put uparsable junk in that example like it "should choke" do asdfasdfasdfasfd end Running the file w/o the line number works ace. When I remove the shared example line: it_behaves_like "...", all goes back to normal. Any thoughts? Even if where to start diagnosing it? My shared example is in a rb file in spec/support. Thanks, Andrew
Andrew Wagner
2011-Feb-17 13:10 UTC
[rspec-users] it_behaves_like and running single examples
To diagnose this, I would start to try to isolate the problem as much as possible. Get it all the way down to one file, outside of rails, with one test that exemplifies the behavior, if need be. And if you get to that point and still see the strangeness...send us a pastebin of it :) On Wed, Feb 16, 2011 at 9:34 AM, Andrew Vargo <ajvargo at gmail.com> wrote:> Hello, > > I am running rspec 2 and rails 3 in a project. > > When I have a shared example being used in a spec file, I loose the > ability to run a single test in that file. > rspec spec/controllers/proposals_controller_spec.rb:13 for instance > will always give me a green ''..'', even if I put uparsable junk in that > example like > it "should choke" do > asdfasdfasdfasfd > end > > Running the file w/o the line number works ace. > > When I remove the shared example line: it_behaves_like "...", all goes > back to normal. > > Any thoughts? Even if where to start diagnosing it? My shared > example is in a rb file in spec/support. > > Thanks, > Andrew > _______________________________________________ > 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/20110217/33497d89/attachment.html>
On Feb 16, 7:34?am, Andrew Vargo <ajva... at gmail.com> wrote:> Hello, > > I am running rspec 2 and rails 3 in a project. > > When I have a shared example being used in a spec file, I loose the > ability to run a single test in that file. > rspec spec/controllers/proposals_controller_spec.rb:13 ?for instance > will always give me a green ''..'', even if I put uparsable junk in that > example like > it "should choke" do > ? asdfasdfasdfasfd > end > > Running the file w/o the line number works ace. > > When I remove the shared example line: it_behaves_like "...", all goes > back to normal. > > Any thoughts? ?Even if where to start diagnosing it? ?My shared > example is in a rb file in spec/support. > > Thanks, > Andrew > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-usersSince there is no code for us to look at, the best I can recommend for you is to use the "-e" or "--example" option instead of the line number option. Example: describe User do context "that is invalid" do it "has an error" do end end end rspec spec/models/user_spec.rb -e "that is invalid" rspec spec/models/user_spec.rb -e "has an error" Hope that helps.