[rspec-devel] [ rspec-Feature Requests-5634 ] support custom expectations

noreply at rubyforge.org noreply at rubyforge.org
Mon Jan 29 22:21:37 EST 2007


Feature Requests item #5634, was opened at 2006-09-05 13:27
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=5634&group_id=797

Category: None
Group: None
>Status: Closed
Priority: 3
Submitted By: David Chelimsky (dchelimsky)
>Assigned to: David Chelimsky (dchelimsky)
Summary: support custom expectations

Initial Comment:
Add a simple hook/API/whatever to allow people to easily build their own custom expectations.

----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-01-30 03:21

Message:
Done as of long before 1442! See rdoc for Spec::Expectations::Matchers for more information.

----------------------------------------------------------------------

Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2006-10-26 16:19

Message:
Makes sense

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2006-10-26 16:00

Message:
To clarify that last comment - this would still require monkey patching, but it would officially document a class to monkey patch that we would commit to maintain (in name).

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2006-10-26 15:56

Message:
I prefer not to encourage monkey patching because it binds rspec's structure to specs outside our control. For example, I recently changed Spec::ShouldHelper and Spec::ShouldNegator to Spec::Expectations::Should and Spec::Expectations::Not respectively. This would break anyone's specs if they were monkey patching.

I'm more inclined to expose a class specifically intended as a hook:

Spec::CustomExpectations

and have rspec look to that class to see if its instances respond to the method in question.

That make sense?

----------------------------------------------------------------------

Comment By: Aslak Hellesøy (aslak_hellesoy)
Date: 2006-09-08 17:48

Message:
What about Ruby's monkeypathing feature?

Just add methods to Spec::ShouldHelper and Spec::ShuoldNegator?

I think this is just a matter of documentation.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=5634&group_id=797


More information about the rspec-devel mailing list