Class: ChefSpec::Stubs::Stub
- Inherits:
-
Object
- Object
- ChefSpec::Stubs::Stub
show all
- Defined in:
- lib/chefspec/stubs/stub.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
4
5
6
|
# File 'lib/chefspec/stubs/stub.rb', line 4
def value
@value
end
|
Instance Method Details
#and_raise(exception) ⇒ Object
11
12
13
14
|
# File 'lib/chefspec/stubs/stub.rb', line 11
def and_raise(exception)
@block = Proc.new { raise exception }
self
end
|
#and_return(value) ⇒ Object
6
7
8
9
|
# File 'lib/chefspec/stubs/stub.rb', line 6
def and_return(value)
@value = value
self
end
|
#result ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/chefspec/stubs/stub.rb', line 16
def result
if @block
recursively_mashify(@block.call)
else
recursively_mashify(@value)
end
end
|