diff options
Diffstat (limited to 'spec/unit/http/api_versions_spec.rb')
-rw-r--r-- | spec/unit/http/api_versions_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/unit/http/api_versions_spec.rb b/spec/unit/http/api_versions_spec.rb index 37f1259d86..91d46763c2 100644 --- a/spec/unit/http/api_versions_spec.rb +++ b/spec/unit/http/api_versions_spec.rb @@ -45,6 +45,7 @@ describe Chef::HTTP::APIVersions do let(:response) do m = double("HttpResponse", :body => response_body) allow(m).to receive(:key?).with("x-ops-server-api-version").and_return(true) + allow(m).to receive(:code).and_return(return_value) allow(m).to receive(:[]) do |key| response_headers[key] end @@ -66,4 +67,13 @@ describe Chef::HTTP::APIVersions do run_api_version_handler expect(Chef::ServerAPIVersions.instance.min_server_version).to eq(0) end + + context "with an unacceptable api version" do + let (:return_value) { "406" } + it "resets the list of supported versions" do + Chef::ServerAPIVersions.instance.set_versions({ "min_version" => 1, "max_version" => 3 }) + run_api_version_handler + expect(Chef::ServerAPIVersions.instance.min_server_version).to eq(0) + end + end end |