spec/grape/middleware/auth/oauth2_spec.rb in grape-0.2.3 vs spec/grape/middleware/auth/oauth2_spec.rb in grape-0.2.4
- old
+ new
@@ -30,11 +30,11 @@
context 'with the token in the query string' do
context 'and a valid token' do
before { get '/awesome?oauth_token=g123' }
- it 'should set env["api.token"]' do
+ it 'sets env["api.token"]' do
last_response.body.should == 'g123'
end
end
context 'and an invalid token' do
@@ -42,15 +42,15 @@
@err = catch :error do
get '/awesome?oauth_token=b123'
end
end
- it 'should throw an error' do
+ it 'throws an error' do
@err[:status].should == 401
end
- it 'should set the WWW-Authenticate header in the response' do
+ it 'sets the WWW-Authenticate header in the response' do
@err[:headers]['WWW-Authenticate'].should == "OAuth realm='OAuth API', error='invalid_token'"
end
end
end
@@ -64,10 +64,10 @@
it { @err[:status].should == 401 }
it { @err[:headers]['WWW-Authenticate'].should == "OAuth realm='OAuth API', error='expired_token'" }
end
%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
+ context 'with the token in the #{head} header' do
before { get '/awesome', {}, head => 'OAuth g123' }
it { last_response.body.should == 'g123' }
end
end