Rename factory "empty_account" to "guest_account"
This commit is contained in:
parent
83ad9a57e7
commit
4a76fcd9c9
|
@ -66,6 +66,10 @@ Style/Documentation:
|
|||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
|
||||
Style/RescueModifier:
|
||||
Exclude:
|
||||
- 'spec/**/*.rb'
|
||||
|
||||
Style/TrailingCommaInArguments:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in New Issue