Forum: RSpec How do I get additional information from the Matcher?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
768d87a25403cb77f2d5efc4a14f1fa5?d=identicon&s=25 Gary Lin (Guest)
on 2009-05-21 00:35
(Received via mailing list)
Hi,

I am trying to implement my own matcher which use a special algorithm to
do the semantics diff-ing between two proprietary configuration file.
When come to the report, I would like my formatter to be able to have
access to the original configuration file content as well as the
diff-ing result.  By digging through the code, looks like all formatter
can get is an ExpectationNotMetError with a string-based message
embedded inside.  How do I make the matcher pass additional information
to my formatter?  I see there is a class level variable called
::Spec::Matchers.last_matcher which allows me to access the last
matcher.  Is that the right away to implement this?  Or if there is any
better way for me to add additional information into the
ExpectationNotMetError exception?

Thanks,

--Gary
5d38ab152e1e3e219512a9859fcd93af?d=identicon&s=25 David Chelimsky (Guest)
on 2009-05-27 05:41
(Received via mailing list)
On Wed, May 20, 2009 at 6:32 PM, Gary Lin <glin@employees.org> wrote:
> me to access the last matcher.  Is that the right away to implement this?
>  Or if there is any better way for me to add additional information into the
> ExpectationNotMetError exception?

There's nothing built in. If you have any recommendations as to how
this should work, please feel free to file a feature request at
http://rspec.lighthouseapp.com.

Thanks,
David
This topic is locked and can not be replied to.