Class: ChefZero::Endpoints::DummyEndpoint
- Defined in:
- lib/chef_zero/endpoints/dummy_endpoint.rb
Constant Summary
Constants inherited from RestBase
RestBase::DEFAULT_REQUEST_VERSION, RestBase::DEFAULT_RESPONSE_VERSION
Instance Attribute Summary
Attributes inherited from RestBase
Instance Method Summary collapse
-
#get(request) ⇒ Object
called by #direct_solr_query, once each for roles, nodes, and data bag items.
- #make_response(value) ⇒ Object
-
#post(request) ⇒ Object
called by #force_solr_commit in pedant’s , which doesn’t check the return value.
Methods inherited from RestBase
#accepts?, #already_json_response, #build_uri, build_uri, #call, #check_api_version, #create_data, #create_data_dir, #data_store, #delete_data, #delete_data_dir, #error, #exists_data?, #exists_data_dir?, #get_data, #get_data_or_else, #hashify_list, #head_request, #initialize, #json_only, #json_response, #list_data, #list_data_or_else, #parse_json, #policy_name_invalid?, #populate_defaults, rfc2396_parser, #set_data, #text_response, #to_json
Constructor Details
This class inherits a constructor from ChefZero::RestBase
Instance Method Details
#get(request) ⇒ Object
called by #direct_solr_query, once each for roles, nodes, and data bag items. each RSpec example makes 3 calls, with the expected sequence of return values [0, 1, 0].
9 10 11 12 13 14 15 16 |
# File 'lib/chef_zero/endpoints/dummy_endpoint.rb', line 9 def get(request) # this could be made less brittle, but if things change to have more than 3 cycles, we should really # be notified by a spec failure. @mock_values ||= ([0, 1, 0] * 3).map { |val| make_response(val) } retval = @mock_values.shift json_response(200, retval) end |
#make_response(value) ⇒ Object
24 25 26 |
# File 'lib/chef_zero/endpoints/dummy_endpoint.rb', line 24 def make_response(value) { "response" => { "numFound" => value } } end |
#post(request) ⇒ Object
called by #force_solr_commit in pedant’s , which doesn’t check the return value.
19 20 21 22 |
# File 'lib/chef_zero/endpoints/dummy_endpoint.rb', line 19 def post(request) # sure thing! json_response(200, { message: "This dummy POST endpoint didn't do anything." }) end |