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