diff options
| author | Marc Florisson | 2015-01-05 18:11:59 +0100 |
|---|---|---|
| committer | Marc Florisson | 2015-01-05 18:11:59 +0100 |
| commit | 421781dfcb08746dae48f84e144a1c92e12dff49 (patch) | |
| tree | 965d319debe4f6c450cbcc60767715de7100fba3 | |
| parent | 3bc6d313bebdc1f03e4021aabbc774a0cd97d938 (diff) | |
| download | chouette-core-421781dfcb08746dae48f84e144a1c92e12dff49.tar.bz2 | |
fix api/v1 request with unknown format.
| -rw-r--r-- | spec/support/api_key_protected.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/spec/support/api_key_protected.rb b/spec/support/api_key_protected.rb index c1ed3b5b5..d48c402c3 100644 --- a/spec/support/api_key_protected.rb +++ b/spec/support/api_key_protected.rb @@ -27,21 +27,27 @@ shared_examples "api key protected controller" do context "when authorization provided and request.accept is #{format}," do before :each do config_formatted_request_with_authorization( format) - h[http_verb].call end it "should assign expected api_key" do - expect(assigns[:api_key]).to eql(api_key) if json_xml_format? + if json_xml_format? + h[http_verb].call + expect(assigns[:api_key]).to eql(api_key) + end end it "should assign expected referential" do - expect(assigns[:referential]).to eq(api_key.referential) if json_xml_format? + if json_xml_format? + h[http_verb].call + expect(assigns[:referential]).to eq(api_key.referential) + end end it "should return #{(format == "application/json" || format == "application/xml") ? "success" : "failure"} response" do if json_xml_format? + h[http_verb].call expect(response).to be_success else - expect(response).not_to be_success + expect {h[http_verb].call}.to raise_error(ActionController::UnknownFormat) end end end |
