class ChefZero::Endpoints::DummyEndpoint
Public Instance Methods
get(request)
click to toggle source
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].
# 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)
click to toggle source
# File lib/chef_zero/endpoints/dummy_endpoint.rb, line 24 def make_response(value) { "response" => { "numFound" => value } } end
post(request)
click to toggle source
called by force_solr_commit in pedant's , which doesn't check the return value.
# 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