Permalink
Browse files

Confirmed the doc format outputs the right values

  • Loading branch information...
1 parent 1aaf5a0 commit 00f014d87cb3bf278425eb565c5f5daa2f7d6e47 @francois francois committed with justinko Apr 7, 2011
Showing with 33 additions and 0 deletions.
  1. +33 −0 features/built_in_matchers/has.feature
@@ -0,0 +1,33 @@
+Feature: has_SOMETHING() matcher
+
+ RSpec provides a helper such that:
+
+ * subject.should have_key(x)
+ * subject.should have_item_with_name(x)
+
+ call the appropriate predicate method.
+
+ Scenario: have_item_with_name(x) on an object that implements #has_item_with_name?
+ Given a file named "have_item_with_name_spec.rb" with:
+ """
+ class O
+ def initialize(array)
+ @array = array
+ end
+
+ def has_item_with_name?(name)
+ @array.include?(name)
+ end
+ end
+
+ describe O.new(%w(francois jake)) do
+ it { should have_item_with_name("francois") }
+ it { should_not have_item_with_name("john") }
+ end
+ """
+
+ When I run `rspec --format doc have_item_with_name_spec.rb`
+ Then the examples should all pass
+ And the output should contain all of these:
+ | should have item with name "francois" |
+ | should not have item with name "john" |

0 comments on commit 00f014d

Please sign in to comment.