Skip to content

Commit

Permalink
Update specs to use expect
Browse files Browse the repository at this point in the history
  • Loading branch information
lcpriest authored and tute committed Nov 1, 2015
1 parent 98ae440 commit 041e708
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions spec/lib/oauth/error_response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@ module Doorkeeper::OAuth
subject { ErrorResponse.new(name: :some_error, state: :some_state).body }

describe '#body' do
it { should have_key(:error) }
it { should have_key(:error_description) }
it { should have_key(:state) }
it { expect(subject).to have_key(:error) }
it { expect(subject).to have_key(:error_description) }
it { expect(subject).to have_key(:state) }
end
end

describe '.authenticate_info' do
let(:error_response) { ErrorResponse.new(name: :some_error, state: :some_state) }
subject { error_response.authenticate_info }

it { should include("realm=\"#{error_response.realm}\"") }
it { should include("error=\"#{error_response.name}\"") }
it { should include("error_description=\"#{error_response.description}\"") }
it { expect(subject).to include("realm=\"#{error_response.realm}\"") }
it { expect(subject).to include("error=\"#{error_response.name}\"") }
it { expect(subject).to include("error_description=\"#{error_response.description}\"") }
end

describe '.headers' do
subject { ErrorResponse.new(name: :some_error, state: :some_state).headers }

it { should include 'WWW-Authenticate' }
it { expect(subject).to include 'WWW-Authenticate' }
end
end
end
4 changes: 2 additions & 2 deletions spec/lib/oauth/error_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module Doorkeeper::OAuth
describe Error do
subject { Error.new(:some_error, :some_state) }

it { should respond_to(:name) }
it { should respond_to(:state) }
it { expect(subject).to respond_to(:name) }
it { expect(subject).to respond_to(:state) }

describe :description do
it 'is translated from translation messages' do
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/oauth/scopes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module Doorkeeper::OAuth

subject { Scopes.from_string(string) }

it { should be_a(Scopes) }
it { expect(subject).to be_a(Scopes) }

describe '#all' do
it 'should be an array of the expected scopes' do
Expand Down
10 changes: 5 additions & 5 deletions spec/models/doorkeeper/access_grant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe Doorkeeper::AccessGrant do
subject { FactoryGirl.build(:access_grant) }

it { should be_valid }
it { expect(subject).to be_valid }

it_behaves_like 'an accessible token'
it_behaves_like 'a revocable token'
Expand All @@ -14,23 +14,23 @@
describe 'validations' do
it 'is invalid without resource_owner_id' do
subject.resource_owner_id = nil
should_not be_valid
expect(subject).not_to be_valid
end

it 'is invalid without application_id' do
subject.application_id = nil
should_not be_valid
expect(subject).not_to be_valid
end

it 'is invalid without token' do
subject.save
subject.token = nil
should_not be_valid
expect(subject).not_to be_valid
end

it 'is invalid without expires_in' do
subject.expires_in = nil
should_not be_valid
expect(subject).not_to be_valid
end
end
end
4 changes: 2 additions & 2 deletions spec/models/doorkeeper/access_token_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Doorkeeper
describe AccessToken do
subject { FactoryGirl.build(:access_token) }

it { should be_valid }
it { expect(subject).to be_valid }

it_behaves_like 'an accessible token'
it_behaves_like 'a revocable token'
Expand Down Expand Up @@ -141,7 +141,7 @@ module NoGenerate
it 'is valid without resource_owner_id' do
# For client credentials flow
subject.resource_owner_id = nil
should be_valid
expect(subject).to be_valid
end
end

Expand Down

0 comments on commit 041e708

Please sign in to comment.