pending caller

View: New views
2 Messages — Rating Filter:   Alert me  

pending caller

by David Chelimsky-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

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@...
http://rubyforge.org/mailman/listinfo/rspec-devel

Re: pending caller

by Scott Taylor-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
> http://rubyforge.org/mailman/listinfo/rspec-devel
>  

_______________________________________________
rspec-devel mailing list
rspec-devel@...
http://rubyforge.org/mailman/listinfo/rspec-devel