Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

cleanup and docs

  • Loading branch information...
commit 012e7900fa6bb2c3d4559d08c1a9a7519d338b38 1 parent acd524a
@grosser authored
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/shoulda/let.rb
View
7 lib/shoulda/let.rb
@@ -3,6 +3,8 @@
context_class = (Shoulda::VERSION >= "3.0.0" ? Shoulda::Context::Context : Shoulda::Context)
context_class.class_eval do
+ # setup method used outside of should blocks
+ # let(:foo){ "Foo" }
def let(name, &block)
@let ||= {}
if block
@@ -13,8 +15,9 @@ def let(name, &block)
end
end
-instance_class = (Shoulda::VERSION >= "3.0.0" ? Test::Unit::TestCase : Shoulda::InstanceMethods)
-instance_class.class_eval do
+Test::Unit::TestCase.class_eval do
+ # instance method used inside of should block
+ # assert_equal @result, let(:foo)
def let(name)
@let ||= {}
@let.fetch(name) do
Please sign in to comment.
Something went wrong with that request. Please try again.