Rebuild rubocop TODOs after auto-correcting

This commit is contained in:
James Mason 2018-04-04 10:18:51 -07:00
parent 31c50255e9
commit 84dbb52d11
No known key found for this signature in database
GPG key ID: 1B3951886C449023
580 changed files with 3689 additions and 3133 deletions

View file

@ -1,7 +1,8 @@
# frozen_string_literal: true
require 'spec_helper'
describe User do
let(:user_admin) { create(:admin) }
let(:conference) { create(:conference, short_title: 'oSC16', title: 'openSUSE Conference 2016') }
let(:conference2) { create(:conference, short_title: 'oSC15', title: 'openSUSE Conference 2015') }
@ -103,7 +104,7 @@ describe User do
describe '#attended_event?' do
context 'user has attended to the event' do
before do
events_registration.update_attributes(attended: true)
events_registration.update(attended: true)
end
it 'returns true' do
@ -186,7 +187,7 @@ describe User do
end
describe '.for_ichain_username' do
before { user.update_attributes(current_sign_in_at: Date.new(2014, 12, 12)) }
before { user.update(current_sign_in_at: Date.new(2014, 12, 12)) }
context 'user exists' do
it 'updates last_sign_in_at of user' do
@ -205,10 +206,10 @@ describe User do
end
context 'user is disabled' do
before { user.update_attributes(is_disabled: true) }
before { user.update(is_disabled: true) }
it 'User.for_ichain_username raises exception if user is disabled' do
expect{ User.for_ichain_username(user.username, email: user.email) }
expect { User.for_ichain_username(user.username, email: user.email) }
.to raise_error(UserDisabled)
end
end
@ -217,14 +218,14 @@ describe User do
describe '.find_for_database_authentication' do
context 'login with username' do
it 'can find user by jumbled username' do
scrambled_username = user.username.chars.map{|c| rand > 0.5 ? c.capitalize : c}.join
scrambled_username = user.username.chars.map { |c| rand > 0.5 ? c.capitalize : c }.join
expect(User.find_for_database_authentication(login: scrambled_username)).to eq(user)
end
end
context 'login with email' do
it 'can find user by jumbled email' do
scrambled_email = user.email.chars.map{|c| rand > 0.5 ? c.capitalize : c}.join
scrambled_email = user.email.chars.map { |c| rand > 0.5 ? c.capitalize : c }.join
expect(User.find_for_database_authentication(login: scrambled_email)).to eq(user)
end
end
@ -242,8 +243,7 @@ describe User do
credentials: {
token: 'mock_token',
secret: 'mock_secret'
}
)
})
end
context 'user is not signed in' do
@ -277,7 +277,7 @@ describe User do
let(:conf2_organizer_role) { Role.find_by(name: 'organizer', resource: conference2) }
before do
user.update_attributes(role_ids: [organizer_role.id, cfp_role.id, conf2_organizer_role.id])
user.update(role_ids: [organizer_role.id, cfp_role.id, conf2_organizer_role.id])
end
it 'returns hash of role and conference' do
@ -336,7 +336,7 @@ describe User do
end
context 'unconfirmed user' do
before { user.update_attributes(confirmed_at: nil) }
before { user.update(confirmed_at: nil) }
it 'returns false' do
expect(user.confirmed?).to eq false
@ -450,7 +450,7 @@ describe User do
describe '.omniauth_providers' do
it 'contains providers' do
expect(User.omniauth_providers).to eq [:suse, :google, :facebook, :github]
expect(User.omniauth_providers).to eq %i[suse google facebook github]
end
end
end