Module: Shoulda::Let::ContextSupport
- Defined in:
- lib/shoulda/let/context_support.rb
Instance Method Summary collapse
-
#let(name, &block) ⇒ Object
setup method used outside of should blocks let(:foo){ “Foo” }.
- #let!(name, &block) ⇒ Object
- #let_defined?(name) ⇒ Boolean
Instance Method Details
#let(name, &block) ⇒ Object
setup method used outside of should blocks let(:foo){ “Foo” }
6 7 8 9 10 11 12 13 14 |
# File 'lib/shoulda/let/context_support.rb', line 6 def let(name, &block) name = name.to_sym @let ||= {} if block @let[name] = block else @let.fetch(name){ parent.let(name) } end end |
#let!(name, &block) ⇒ Object
16 17 18 19 |
# File 'lib/shoulda/let/context_support.rb', line 16 def let!(name, &block) let(name, &block) setup { let(name) } end |
#let_defined?(name) ⇒ Boolean
21 22 23 24 25 |
# File 'lib/shoulda/let/context_support.rb', line 21 def let_defined?(name) name = name.to_sym ( @let and @let.has_key?(name) ) || ( parent.respond_to?(:let_defined?) and parent.let_defined?(name) ) end |