spec/cases/oauth_spec.rb in koala-2.2.0 vs spec/cases/oauth_spec.rb in koala-2.3.0rc1
- old
+ new
@@ -583,21 +583,21 @@
describe "for parsing signed requests" do
# the signed request code is ported directly from Facebook
# so we only need to test at a high level that it works
it "throws an error if the algorithm is unsupported" do
allow(MultiJson).to receive(:load).and_return("algorithm" => "my fun algorithm")
- expect { @oauth.parse_signed_request(@signed_request) }.to raise_error
+ expect { @oauth.parse_signed_request(@signed_params) }.to raise_error(Koala::Facebook::OAuthSignatureError)
end
it "throws an error if the signature is invalid" do
allow(OpenSSL::HMAC).to receive(:hexdigest).and_return("i'm an invalid signature")
- expect { @oauth.parse_signed_request(@signed_request) }.to raise_error
+ expect { @oauth.parse_signed_request(@signed_params) }.to raise_error(Koala::Facebook::OAuthSignatureError)
end
it "throws an error if the signature string is empty" do
# this occasionally happens due to Facebook error
- expect { @oauth.parse_signed_request("") }.to raise_error
- expect { @oauth.parse_signed_request("abc-def") }.to raise_error
+ expect { @oauth.parse_signed_request("") }.to raise_error(Koala::Facebook::OAuthSignatureError)
+ expect { @oauth.parse_signed_request("abc-def") }.to raise_error(Koala::Facebook::OAuthSignatureError)
end
it "properly parses requests" do
@oauth = Koala::Facebook::OAuth.new(@app_id, @secret || @app_secret)
expect(@oauth.parse_signed_request(@signed_params)).to eq(@signed_params_result)