spec/grape/middleware/auth/oauth2_spec.rb in grape-0.1.4 vs spec/grape/middleware/auth/oauth2_spec.rb in grape-0.1.5
- old
+ new
@@ -63,13 +63,15 @@
it { @err[:status].should == 401 }
it { @err[:headers]['WWW-Authenticate'].should == "OAuth realm='OAuth API', error='expired_token'" }
end
- context 'with the token in the header' do
- before { get '/awesome', {}, 'Authorization' => 'OAuth g123' }
- it { last_response.body.should == 'g123' }
+ %w(HTTP_AUTHORIZATION X_HTTP_AUTHORIZATION X-HTTP_AUTHORIZATION REDIRECT_X_HTTP_AUTHORIZATION).each do |head|
+ context "with the token in the #{head} header" do
+ before { get '/awesome', {}, head => 'OAuth g123' }
+ it { last_response.body.should == 'g123' }
+ end
end
context 'with the token in the POST body' do
before { post '/awesome', {'oauth_token' => 'g123'} }
it { last_response.body.should == 'g123'}
@@ -83,6 +85,6 @@
end
it { @err[:headers]['WWW-Authenticate'].should == "OAuth realm='OAuth API', error='insufficient_scope'" }
it { @err[:status].should == 403 }
end
-end
\ No newline at end of file
+end