Class: ChefSpec::Stubs::DataBagItemStub
- Defined in:
- lib/chefspec/stubs/data_bag_item_stub.rb
Instance Attribute Summary collapse
-
#bag ⇒ Object
readonly
Returns the value of attribute bag.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Attributes inherited from Stub
Instance Method Summary collapse
-
#initialize(bag, id, &block) ⇒ DataBagItemStub
constructor
A new instance of DataBagItemStub.
- #signature ⇒ Object
Methods inherited from Stub
#and_raise, #and_return, #result
Constructor Details
#initialize(bag, id, &block) ⇒ DataBagItemStub
Returns a new instance of DataBagItemStub.
10 11 12 13 14 |
# File 'lib/chefspec/stubs/data_bag_item_stub.rb', line 10 def initialize(bag, id, &block) @bag = bag.to_s @id = id @block = block end |
Instance Attribute Details
#bag ⇒ Object (readonly)
Returns the value of attribute bag.
8 9 10 |
# File 'lib/chefspec/stubs/data_bag_item_stub.rb', line 8 def bag @bag end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
6 7 8 |
# File 'lib/chefspec/stubs/data_bag_item_stub.rb', line 6 def block @block end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/chefspec/stubs/data_bag_item_stub.rb', line 7 def id @id end |
Instance Method Details
#signature ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/chefspec/stubs/data_bag_item_stub.rb', line 16 def signature if @block "stub_data_bag_item(#{@bag.inspect}, #{@id.inspect}) { # Ruby code }" else "stub_data_bag_item(#{@bag.inspect}, #{@id.inspect}).and_return(#{@value})" end end |