Permalink
Browse files

don't give up on the attribute subject just because it returns nil

Closes #31.
  • Loading branch information...
1 parent 4d4d0cf commit 3642323cf6a2238f447e31bd53932a18a7afd35d @danp danp committed with dchelimsky Jun 2, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/rspec/core/subject.rb
@@ -9,7 +9,7 @@ def self.included(kls)
end
def subject
- attribute_of_subject || original_subject
+ using_attribute? ? attribute_of_subject : original_subject
end
# When +should+ is called with no explicit receiver, the call is
@@ -80,7 +80,7 @@ def original_subject
end
def attribute_of_subject
- original_subject.send(running_example.description) if using_attribute?
+ original_subject.send(running_example.description) if using_attribute?
end
def using_attribute?

0 comments on commit 3642323

Please sign in to comment.