On Sun, Sep 13, 2009 at 10:05 AM, Brian Cardarella
<[email protected]> wrote:
> If I'm writing a matcher is there anyway to access the scope of the
> example from within the matcher? (something that already exists in
> rspec, not passing a new binding to the matcher)
There is nothing implicit as of yet. You _can_ wrap a matcher in a
method that refs the example in such that you don't have to pass it in
where it's used:
def match_something
scope = self
Spec::Matchers::Matcher.new :match_something do
match do |actual|
#access scope here
end
end
end
Not exactly what you're looking for, but cleaner than having to say
"thing.should somehow_match(whatever, self)"
HTH,
David
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users