Enables RSpec/ExampleWording and fixes all issues

Both avoiding 'should' and repiting 'it' on the tests description
improves reading them and also makes all descriptions consistent.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
This commit is contained in:
Bertocq
2018-01-07 00:57:50 +01:00
parent 971f2e308a
commit ed16a78f42
73 changed files with 482 additions and 479 deletions

View File

@@ -4,38 +4,38 @@ describe ManagerAuthenticator do
let(:authenticator) { described_class.new(login: "JJB033", clave_usuario: "31415926", fecha_conexion: "20151031135905") }
describe 'initialization params' do
it 'should cause auth to return false if blank login' do
it 'causes auth to return false if blank login' do
blank_login_authenticator = described_class.new(login: "", clave_usuario: "31415926", fecha_conexion: "20151031135905")
expect(blank_login_authenticator.auth).to be false
end
it 'should cause auth to return false if blank user_key' do
it 'causes auth to return false if blank user_key' do
blank_user_key_authenticator = described_class.new(login: "JJB033", clave_usuario: "", fecha_conexion: "20151031135905")
expect(blank_user_key_authenticator.auth).to be false
end
it 'should cause auth to return false if blank date' do
it 'causes auth to return false if blank date' do
blank_date_authenticator = described_class.new(login: "JJB033", clave_usuario: "31415926", fecha_conexion: "")
expect(blank_date_authenticator.auth).to be false
end
end
describe '#auth' do
it 'should return false if not manager_exists' do
it 'returns false if not manager_exists' do
allow(authenticator).to receive(:manager_exists?).and_return(false)
allow(authenticator).to receive(:application_authorized?).and_return(true)
expect(authenticator.auth).to be false
end
it 'should return false if not application_authorized' do
it 'returns false if not application_authorized' do
allow(authenticator).to receive(:manager_exists?).and_return(true)
allow(authenticator).to receive(:application_authorized?).and_return(false)
expect(authenticator.auth).to be false
end
it 'should return ok if manager_exists and application_authorized' do
it 'returns ok if manager_exists and application_authorized' do
allow(authenticator).to receive(:manager_exists?).and_return(true)
allow(authenticator).to receive(:application_authorized?).and_return(true)
@@ -44,14 +44,14 @@ describe ManagerAuthenticator do
end
describe 'SOAP' do
it 'should call the verification user method' do
it 'calls the verification user method' do
message = { ub: {user_key: "31415926", date: "20151031135905"} }
allow(authenticator).to receive(:application_authorized?).and_return(true)
expect(authenticator.send(:client)).to receive(:call).with(:get_status_user_data, message: message)
authenticator.auth
end
it 'should call the permissions check method' do
it 'calls the permissions check method' do
allow(authenticator).to receive(:manager_exists?).and_return(true)
expect(authenticator.send(:client)).to receive(:call).with(:get_applications_user_list, message: { ub: {user_key: "31415926"} })
authenticator.auth

View File

@@ -22,7 +22,7 @@ describe 'Settings Rake' do
run_rake_task
end
it 'should have per_page_code_head setting present and no per_page_code' do
it 'has per_page_code_head setting present and no per_page_code' do
expect(Setting.where(key: 'per_page_code_head').count).to eq(1)
expect(Setting['per_page_code_head']).to eq(nil)
expect(Setting.where(key: 'per_page_code').count).to eq(0)
@@ -36,7 +36,7 @@ describe 'Settings Rake' do
run_rake_task
end
it 'should have per_page_code_head setting present and no per_page_code' do
it 'has per_page_code_head setting present and no per_page_code' do
expect(Setting.where(key: 'per_page_code_head').count).to eq(1)
expect(Setting['per_page_code_head']).to eq('per_page_code_head')
expect(Setting.where(key: 'per_page_code').count).to eq(0)
@@ -50,7 +50,7 @@ describe 'Settings Rake' do
run_rake_task
end
it 'should have per_page_code_head setting present and no per_page_code' do
it 'has per_page_code_head setting present and no per_page_code' do
expect(Setting.where(key: 'per_page_code_head').count).to eq(1)
expect(Setting['per_page_code_head']).to eq('per_page_code_head')
expect(Setting.where(key: 'per_page_code').count).to eq(0)
@@ -64,7 +64,7 @@ describe 'Settings Rake' do
run_rake_task
end
it 'should have per_page_code_head setting present and no per_page_code' do
it 'has per_page_code_head setting present and no per_page_code' do
expect(Setting.where(key: 'per_page_code_head').count).to eq(1)
expect(Setting['per_page_code_head']).to eq('per_page_code')
expect(Setting.where(key: 'per_page_code').count).to eq(0)