Skip to content
Browse files

#as_null_object cucumber feature

  • Loading branch information...
1 parent 5f02fb6 commit f89af2418c81da5b30895174aa62a1bec4c884b9 @justinko justinko committed Mar 6, 2011
Showing with 28 additions and 0 deletions.
  1. +28 −0 features/method_stubs/as_null_object.feature
View
28 features/method_stubs/as_null_object.feature
@@ -0,0 +1,28 @@
+Feature: as_null_object method stub
+
+ Use the `as_null_object` method to ignore any messages that
+ aren't explicitly set as stubs or message expectations.
+
+ Scenario: as_null_object implementation
+ Given a file named "as_null_object_spec.rb" with:
+ """
+ describe "a double with as_null_object called" do
+ subject { double('null object').as_null_object }
+
+ it "responds to any method that is not defined" do
+ subject.should respond_to(:an_undefined_method)
+ end
+
+ it "allows explicit stubs" do
+ subject.stub(:foo) { "bar" }
+ subject.foo.should eq("bar")
+ end
+
+ it "allows explicit expectations" do
+ subject.should_receive(:something)
+ subject.something
+ end
+ end
+ """
+ When I run "rspec as_null_object_spec.rb"
+ Then the examples should all pass

0 comments on commit f89af24

Please sign in to comment.
Something went wrong with that request. Please try again.