Skip to content

Commit

Permalink
Merge pull request #840 from aviav/admin-factory-fix
Browse files Browse the repository at this point in the history
Generate admins with account membership in specs
  • Loading branch information
tf authored Aug 28, 2017
2 parents 1905b0b + 980d471 commit 5f21f8e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions spec/factories/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ module Pageflow

trait :admin do
admin true
after(:create) do |user, evaluator|
create(:membership,
user: user,
role: :member,
entity: evaluator.on || create(:account))
end
end

trait :suspended do
Expand Down
2 changes: 1 addition & 1 deletion spec/policies/pageflow/folder_policy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module Pageflow
it 'does not permit admins when there is no more than one account' do
Account.delete_all
folder = create(:folder)
admin = create(:user, :admin)
admin = create(:user, :admin, on: folder.account)

expect(FolderPolicy.new(admin, folder)).not_to permit_action(:show_account_selection_on)
end
Expand Down

0 comments on commit 5f21f8e

Please sign in to comment.