diff --git a/.rubocop.yml b/.rubocop.yml index f0fdd6f..a0f858b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -66,6 +66,10 @@ Style/Documentation: Style/DoubleNegation: Enabled: false +Style/RescueModifier: + Exclude: + - 'spec/**/*.rb' + Style/TrailingCommaInArguments: EnforcedStyleForMultiline: comma diff --git a/app/models/account.rb b/app/models/account.rb index 36a9f8a..00f4647 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -17,6 +17,7 @@ class Account < ApplicationRecord def add_role(_role_name, _resource = nil) raise 'can not add role to guest account' if guest? + super end end diff --git a/factories/accounts.rb b/factories/accounts.rb index 77cf81a..e696628 100644 --- a/factories/accounts.rb +++ b/factories/accounts.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true FactoryBot.define do - factory :empty_account, class: Account + factory :guest_account, class: Account - factory :account_with_user, parent: :empty_account do + factory :account_with_user, parent: :guest_account do association :user end diff --git a/factories/membership_applications.rb b/factories/membership_applications.rb index c4e40d8..dbd6bee 100644 --- a/factories/membership_applications.rb +++ b/factories/membership_applications.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :membership_application do - association :account, factory: :empty_account + association :account, factory: :guest_account association :country_state first_name { Faker::Name.first_name } diff --git a/factories/users.rb b/factories/users.rb index 620a200..d38e02e 100644 --- a/factories/users.rb +++ b/factories/users.rb @@ -2,7 +2,7 @@ FactoryBot.define do factory :user do - association :account, factory: :empty_account + association :account, factory: :guest_account email { Faker::Internet.email } password { Faker::Internet.password } diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index c49088d..aa7bcea 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -30,7 +30,7 @@ RSpec.describe Account do describe '#add_role' do context 'to guest account' do - subject { create :empty_account } + subject { create :guest_account } let(:result) { subject.add_role :superuser } @@ -40,8 +40,9 @@ RSpec.describe Account do end specify do - expect { result rescue nil }.not_to \ - change { subject.roles.reload.count } + expect { result rescue nil }.not_to( + change { subject.roles.reload.count }, + ) end end end