[rspec-devel] pending caller

Scott Taylor scott at railsnewbie.com
Wed Apr 1 03:50:24 EDT 2009


David Chelimsky wrote:
> Hi all,
>
> The rspec-1.2.2 release cleaned up what gets passed to formatters,
> introducing ExampleGroupProxy and ExampleProxy objects that each
> export description() and location():
>
> description is the docstring passed to describe() and it() or any of
> their aliases
> location is the filename and line number where the group or example was declared
>
> Currently the formatters have an example_pending method:
>
> example_pending(example_proxy, message, pending_location)
>
> The pending_location (previously pending_caller) is the file and line
> number where the pending statement is declared, as opposed to the
> location of the example. So in this case:
>
> describe "subject" do
>   it "does something" do
>     pending "a fix" do
>       subject.should_not be_broken
>     end
>   end
> end
>
> example_group.location is line 1
> example.location is line 2
> pending_location is line 3
>
> I'm thinking that now that example_group.location and example.location
> are consistent, that pending_location is redundant even though it's a
> different line.
>   
Yeah - it is.  You'll want the line number of the example, not of the 
pending call.

Speaking of which, I'd sort of like the file and line numbers for xit'ed 
specs. 

Scott
> Of course the problem here is how to effectively deprecate
> pending_location, but that's another matter :)
>
> Any thoughts about this?
>
> -- David
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
>   



More information about the rspec-devel mailing list