spec/rack/oauth2/server/token/assertion_spec.rb in rack-oauth2-0.0.6 vs spec/rack/oauth2/server/token/assertion_spec.rb in rack-oauth2-0.0.7

- old
+ new

@@ -11,11 +11,16 @@ end @request = Rack::MockRequest.new @app end it "should return access_token as json response body" do - response = @request.get("/?grant_type=assertion&client_id=valid_client&assertion=valid_assertion&assertion_type=something") + response = @request.post("/", :params => { + :grant_type => "assertion", + :client_id => "valid_client", + :assertion => "valid_assertion", + :assertion_type => "something" + }) response.status.should == 200 response.content_type.should == "application/json" response.body.should == "{\"access_token\":\"access_token\"}" end @@ -30,11 +35,16 @@ end @request = Rack::MockRequest.new @app end it "should return error message as json response body" do - response = @request.get("/?grant_type=assertion&client_id=valid_client&assertion=invalid_assertion&assertion_type=something") - response.status.should == 401 + response = @request.post("/", :params => { + :grant_type => "assertion", + :client_id => "valid_client", + :assertion => "invalid_assertion", + :assertion_type => "something" + }) + response.status.should == 400 response.content_type.should == "application/json" response.body.should == "{\"error_description\":\"Invalid assertion.\",\"error\":\"invalid_grant\"}" end end \ No newline at end of file