[rspec-devel] [ rspec-Feature Requests-10133 ] custom predicate matchers
noreply at rubyforge.org
noreply at rubyforge.org
Mon Apr 16 06:30:59 EDT 2007
Feature Requests item #10133, was opened at 2007-04-16 10:30
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=10133&group_id=797
Category: expectation module
Group: None
Status: Open
Priority: 3
Submitted By: David Chelimsky (dchelimsky)
Assigned to: David Chelimsky (dchelimsky)
Summary: custom predicate matchers
Initial Comment:
RSpec <= 0.8 let you do this:
obj.should_predicate
For example:
obj.should_exist
which would pass if obj.exist? returns true.
In RSpec 0.9, there is no underscore-less parallel:
obj.should exist
This was excluded deliberately because when RSpec does not find the #exist method there are more than one reason that it might be missing: it could be a helper method that hasn't been written yet OR it could be a predicate on obj that hasn't been written yet.
I still think this is the correct decision, however, the following would support easy creation of custom predicate matchers:
Spec::Runner.configure do |config|
config.predicate_matchers :exist
end
and/or
describe Thing do
predicate_matchers :exist
it "should exist" do
Thing.new.should exist
end
end
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=10133&group_id=797
More information about the rspec-devel
mailing list