Permalink
Browse files

let for spec

  • Loading branch information...
1 parent 60d71f4 commit cdd3e2dd8af5663dd7ca95753759be21d4858fb2 @yannlugrin yannlugrin committed Feb 24, 2012
Showing with 11 additions and 4 deletions.
  1. +2 −2 .travis.yml
  2. 0 gemfiles/{minitest-2.1 → minitest-2}
  3. +9 −2 spec/spec_helper.rb
View
@@ -12,11 +12,11 @@ rvm:
# - rbx-19mode
gemfile:
- gemfiles/minitest-1.7
- - gemfiles/minitest-2.1
+ - gemfiles/minitest-2
matrix:
exclude:
- rvm: 1.8.7
- gemfile: gemfiles/minitest-2.1
+ gemfile: gemfiles/minitest-2
notifications:
recipients:
- yann.lugrin@sans-savoir.net
File renamed without changes.
View
@@ -13,17 +13,24 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
after(:each) do
ENV['GUARD_ENV'] = nil
+ @_memoized = nil
+
if MiniTest::Unit.const_defined?(:VERSION)
MiniTest::Unit::VERSION.replace(@real_minitest_version)
else
MiniTest::Unit.send(:const_set, :VERSION, @real_minitest_version)
end
end
- def subject; end
+ def self.let(name, &block)
+ define_method name do
+ @_memoized ||= {}
+ @_memoized.fetch(name) { |k| @_memoized[k] = instance_eval(&block) }
+ end
+ end
def self.subject(&block)
- define_method :subject, &block
+ let :subject, &block
end
def fixtures_path

0 comments on commit cdd3e2d

Please sign in to comment.