Permalink
Browse files

add more features from rspec-core (one is still @wip)

  • Loading branch information...
1 parent 7a9954c commit 1e037cd943a14a503b35b809c11d89ca394aebd9 @dchelimsky dchelimsky committed Mar 8, 2010
@@ -0,0 +1,27 @@
+Feature: define diffable matcher
+
+ When a matcher is defined as diffable, and the --diff
+ flag is set, the output will include a diff of the submitted
+ objects.
+
+ @wip
+ Scenario: define a diffable matcher
+ Given a file named "diffable_matcher_spec.rb" with:
+ """
+ Rspec::Matchers.define :be_just_like do |expected|
+ match do |actual|
+ actual == expected
+ end
+
+ diffable
+ end
+
+ describe "this" do
+ it {should be_just_like("that")}
+ end
+ """
+ When I run "rspec diffable_matcher_spec.rb --diff"
+ Then the exit status should not be 0
+
+ And I should see "should be just like that"
+ And I should see "Diff:\n@@ -1,2 +1,2 @@\n-that\n+this"
@@ -0,0 +1,27 @@
+Feature: define matcher
+
+ In order to express my domain clearly in my code examples
+ As an RSpec user
+ I want to define matchers with fluent interfaces
+
+ Scenario: one additional method
+ Given a file named "between_spec.rb" with:
+ """
+ Rspec::Matchers.define :be_bigger_than do |first|
+ def but_smaller_than(second)
+ @second = second
+ self
+ end
+
+ match do |actual|
+ (actual > first) && (actual < @second)
+ end
+ end
+
+ describe 5 do
+ it { should be_bigger_than(4).but_smaller_than(6) }
+ end
+ """
+ When I run "rspec between_spec.rb --format specdoc"
+ Then I should see "1 example, 0 failures"
+ And I should see "should be bigger than 4"

0 comments on commit 1e037cd

Please sign in to comment.