Skip to content

Commit

Permalink
Updated Readme.
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy McAnally <jeremymcanally@gmail.com>
  • Loading branch information
mhennemeyer authored and jm committed Feb 11, 2009
1 parent 9b4f8a1 commit 15bf16d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.rdoc
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ Hate writing assertions? Need a little behavior-driven love in your tests? The


* Most of familiar RSpec Matchers are built in * Most of familiar RSpec Matchers are built in


*raise_error # raise_error matcher
lambda {raise}.should raise_error #pass lambda {raise}.should raise_error #pass
lambda {raise MyCustomError}.should raise_error(MyCustomError) #pass lambda {raise MyCustomError}.should raise_error(MyCustomError) #pass
lambda {raise "message"}.should raise_error("message") #pass lambda {raise "message"}.should raise_error("message") #pass
lambda {raise "message"}.should raise_error(/essa/) #pass lambda {raise "message"}.should raise_error(/essa/) #pass


*change # change matcher
lambda {@var+=1}.should change {@var} lambda {@var+=1}.should change {@var}
# passes # passes
lambda { }.should change {@var} lambda { }.should change {@var}
Expand All @@ -48,7 +48,7 @@ Hate writing assertions? Need a little behavior-driven love in your tests? The
lambda {@var+=1}.should change {@var}.from(1).to(2) lambda {@var+=1}.should change {@var}.from(1).to(2)
# passes # passes


*be_something # be_something matcher
@obj.should be_something @obj.should be_something
# passes if @obj.something? is true # passes if @obj.something? is true


Expand All @@ -58,7 +58,7 @@ Hate writing assertions? Need a little behavior-driven love in your tests? The


* Create your own matchers * Create your own matchers


* nil_matcher (As a simple and quick example) # nil_matcher (As a simple and quick example)
def_matcher :be_nil do |receiver, matcher, args| def_matcher :be_nil do |receiver, matcher, args|
receiver.nil? receiver.nil?
end end
Expand All @@ -68,8 +68,8 @@ Hate writing assertions? Need a little behavior-driven love in your tests? The
'notnil'.should be_nil # fails 'notnil'.should be_nil # fails
'notnil'.should_not be_nil # pass 'notnil'.should_not be_nil # pass


* have(n).somethings matcher (a little bit more complex) # have(n).somethings matcher (A little bit more complex)
def_matcher :have do |receiver, matcher, args| def_matcher :have do |receiver, matcher, args|
count = args[0] count = args[0]
something = matcher.msgs[0].name something = matcher.msgs[0].name
actual = receiver.send(something).length actual = receiver.send(something).length
Expand Down

0 comments on commit 15bf16d

Please sign in to comment.