Created
December 27, 2012 14:55
-
-
Save jimweirich/4388888 to your computer and use it in GitHub Desktop.
Experimental version of RSpec/Given that handles should-less assertions (i.e. plain Ruby conditions).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Natural Assertions | |
Failure/Error: Then { foo + bar == 2 } | |
Then expression failed at /Users/jim/working/git/rspec-given/examples/failing/sample_spec.rb:6 | |
expected: 3 | |
to equal: 2 | |
false <- foo + bar == 2 | |
3 <- foo + bar | |
1 <- foo | |
2 <- bar | |
# ./lib/rspec/given/extensions.rb:64:in `_rg_evaluate' | |
# ./lib/rspec/given/extensions.rb:56:in `_rg_then' | |
# ./examples/failing/sample_spec.rb:6:in `block in Then' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rspec/given' | |
describe "Natural Assertions" do | |
Given(:foo) { 1 } | |
Given(:bar) { 2 } | |
Then { foo + bar == 2 } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment