From 041e708956a1d1cc99af342bb456024c10d36368 Mon Sep 17 00:00:00 2001 From: Lachlan Priest Date: Thu, 22 Oct 2015 23:09:46 +0800 Subject: [PATCH] Update specs to use expect http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ [fixes #731] --- spec/lib/oauth/error_response_spec.rb | 14 +++++++------- spec/lib/oauth/error_spec.rb | 4 ++-- spec/lib/oauth/scopes_spec.rb | 2 +- spec/models/doorkeeper/access_grant_spec.rb | 10 +++++----- spec/models/doorkeeper/access_token_spec.rb | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/spec/lib/oauth/error_response_spec.rb b/spec/lib/oauth/error_response_spec.rb index 563621cac..58f2625d1 100644 --- a/spec/lib/oauth/error_response_spec.rb +++ b/spec/lib/oauth/error_response_spec.rb @@ -37,9 +37,9 @@ 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 @@ -47,15 +47,15 @@ module Doorkeeper::OAuth 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 diff --git a/spec/lib/oauth/error_spec.rb b/spec/lib/oauth/error_spec.rb index 9703cdd71..6ca42ec9c 100644 --- a/spec/lib/oauth/error_spec.rb +++ b/spec/lib/oauth/error_spec.rb @@ -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 diff --git a/spec/lib/oauth/scopes_spec.rb b/spec/lib/oauth/scopes_spec.rb index 1d3e9813a..2e9c8e79d 100644 --- a/spec/lib/oauth/scopes_spec.rb +++ b/spec/lib/oauth/scopes_spec.rb @@ -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 diff --git a/spec/models/doorkeeper/access_grant_spec.rb b/spec/models/doorkeeper/access_grant_spec.rb index 37b33510f..f0e49d4b2 100644 --- a/spec/models/doorkeeper/access_grant_spec.rb +++ b/spec/models/doorkeeper/access_grant_spec.rb @@ -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' @@ -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 diff --git a/spec/models/doorkeeper/access_token_spec.rb b/spec/models/doorkeeper/access_token_spec.rb index 1c2ad7469..ff0e9ba3c 100644 --- a/spec/models/doorkeeper/access_token_spec.rb +++ b/spec/models/doorkeeper/access_token_spec.rb @@ -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' @@ -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