Skip to content

Commit

Permalink
Fix rspec warnings
Browse files Browse the repository at this point in the history
Spec threw warnings as raise_error didn’t provide an Error Class to
assert on. Indeed in one case the wrong error was raised than expected.

[fixes doorkeeper-gem#711]
  • Loading branch information
Tobias Bielohlawek authored and tute committed Aug 23, 2015
1 parent f52fa09 commit 0ca5440
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions spec/models/doorkeeper/access_token_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,17 @@ module NoGenerate
it 'is not valid if token exists' do
token1 = FactoryGirl.create :access_token, use_refresh_token: true
token2 = FactoryGirl.create :access_token, use_refresh_token: true
token2.send :write_attribute, :refresh_token, token1.refresh_token
token2.refresh_token = token1.refresh_token
expect(token2).not_to be_valid
end

it 'expects database to raise an error if refresh tokens are the same' do
token1 = FactoryGirl.create :access_token, use_refresh_token: true
token2 = FactoryGirl.create :access_token, use_refresh_token: true
expect do
token2.write_attribute :refresh_token, token1.refresh_token
token2.refresh_token = token1.refresh_token
token2.save(validate: false)
end.to raise_error
end.to raise_error(ActiveRecord::RecordNotUnique)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/doorkeeper/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ module Doorkeeper
app1 = FactoryGirl.create(:application)
app2 = FactoryGirl.create(:application)
app2.uid = app1.uid
expect { app2.save!(validate: false) }.to raise_error
expect { app2.save!(validate: false) }.to raise_error(ActiveRecord::RecordNotUnique)
end

it 'generate secret on create' do
Expand Down
2 changes: 1 addition & 1 deletion spec/support/shared/models_shared_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
token2.token = token1.token
expect do
token2.save!(validate: false)
end.to raise_error
end.to raise_error(ActiveRecord::RecordNotUnique)
end
end
end

0 comments on commit 0ca5440

Please sign in to comment.