spec/requests/flows/password_spec.rb in doorkeeper-1.1.0 vs spec/requests/flows/password_spec.rb in doorkeeper-1.2.0
- old
+ new
@@ -10,15 +10,15 @@
client_exists
create_resource_owner
end
context 'with valid user credentials' do
- scenario "should issue new token" do
+ scenario 'should issue new token' do
pending 'Check a way to supress warnings here (or handle config better)'
- expect {
- post password_token_endpoint_url(:client => @client, :resource_owner => @resource_owner)
- }.to_not change { Doorkeeper::AccessToken.count }
+ expect do
+ post password_token_endpoint_url(client: @client, resource_owner: @resource_owner)
+ end.to_not change { Doorkeeper::AccessToken.count }
end
end
end
feature 'Resource Owner Password Credentials Flow' do
@@ -27,62 +27,62 @@
client_exists
create_resource_owner
end
context 'with valid user credentials' do
- scenario "should issue new token" do
- expect {
- post password_token_endpoint_url(:client => @client, :resource_owner => @resource_owner)
- }.to change { Doorkeeper::AccessToken.count }.by(1)
+ scenario 'should issue new token' do
+ expect do
+ post password_token_endpoint_url(client: @client, resource_owner: @resource_owner)
+ end.to change { Doorkeeper::AccessToken.count }.by(1)
token = Doorkeeper::AccessToken.first
should_have_json 'access_token', token.token
end
- scenario "should issue new token without client credentials" do
- expect {
- post password_token_endpoint_url(:resource_owner => @resource_owner)
- }.to change { Doorkeeper::AccessToken.count }.by(1)
+ scenario 'should issue new token without client credentials' do
+ expect do
+ post password_token_endpoint_url(resource_owner: @resource_owner)
+ end.to change { Doorkeeper::AccessToken.count }.by(1)
token = Doorkeeper::AccessToken.first
should_have_json 'access_token', token.token
end
- scenario "should issue a refresh token if enabled" do
+ scenario 'should issue a refresh token if enabled' do
config_is_set(:refresh_token_enabled, true)
- post password_token_endpoint_url(:client => @client, :resource_owner => @resource_owner)
+ post password_token_endpoint_url(client: @client, resource_owner: @resource_owner)
token = Doorkeeper::AccessToken.first
should_have_json 'refresh_token', token.refresh_token
end
end
- context "with invalid user credentials" do
- scenario "should not issue new token with bad password" do
- expect {
- post password_token_endpoint_url( :client => @client,
- :resource_owner_username => @resource_owner.name,
- :resource_owner_password => 'wrongpassword')
- }.to_not change { Doorkeeper::AccessToken.count }
+ context 'with invalid user credentials' do
+ scenario 'should not issue new token with bad password' do
+ expect do
+ post password_token_endpoint_url(client: @client,
+ resource_owner_username: @resource_owner.name,
+ resource_owner_password: 'wrongpassword')
+ end.to_not change { Doorkeeper::AccessToken.count }
end
- scenario "should not issue new token without credentials" do
- expect {
- post password_token_endpoint_url( :client => @client)
- }.to_not change { Doorkeeper::AccessToken.count }
+ scenario 'should not issue new token without credentials' do
+ expect do
+ post password_token_endpoint_url(client: @client)
+ end.to_not change { Doorkeeper::AccessToken.count }
end
end
- context "with invalid client credentials" do
- scenario "should not issue new token with bad client credentials" do
- expect {
- post password_token_endpoint_url( :client_id => @client.uid,
- :client_secret => "bad_secret",
- :resource_owner => @resource_owner)
- }.to_not change { Doorkeeper::AccessToken.count }
+ context 'with invalid client credentials' do
+ scenario 'should not issue new token with bad client credentials' do
+ expect do
+ post password_token_endpoint_url(client_id: @client.uid,
+ client_secret: 'bad_secret',
+ resource_owner: @resource_owner)
+ end.to_not change { Doorkeeper::AccessToken.count }
end
end
end