Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RSpec::Matchers.define :act_like_a_good_foo do
- match do
- # subject is implicit in example
- subject.has_bar?.should == true
- subject.should be_true # predicate matchers defined within RSpec::Matchers
- subject.should have_bar
- end
- end
- describe Foo do
- it { should act_like_a_good_foo }
- end
- class MyAssertions
- include RSpec::Matchers
- def assert_everything_is_ok
- @foo = Foo.new
- @foo.has_bar?.should == true # works!
- @foo.has_bar?.should be_true # works now :)
- @foo.should have_bar # works now :)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement