From d0f88154928a2107d17f2a3bb53360cee699f8f1 Mon Sep 17 00:00:00 2001 From: James Golick Date: Fri, 16 Jan 2009 16:01:09 -0500 Subject: [PATCH] fix case where a context with no expects blocks explodes --- lib/zebra/shoulda.rb | 2 +- test/shoulda/shoulda_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/zebra/shoulda.rb b/lib/zebra/shoulda.rb index 4e40732..1c63fbc 100644 --- a/lib/zebra/shoulda.rb +++ b/lib/zebra/shoulda.rb @@ -34,7 +34,7 @@ def create_test_from_expect(&block) end def build_with_expects - expects.each { |e| create_test_from_expect(&e) } + (expects || []).each { |e| create_test_from_expect(&e) } build_without_expects end end diff --git a/test/shoulda/shoulda_test.rb b/test/shoulda/shoulda_test.rb index 1bf5381..901d1b1 100644 --- a/test/shoulda/shoulda_test.rb +++ b/test/shoulda/shoulda_test.rb @@ -17,4 +17,10 @@ def setup assert self.respond_to?("test: in a context expect true"), self.class.instance_methods.grep(/test/).inspect end end + + context "A context with no expects" do + should "not raise any exceptions" do + true + end + end end