From 1a995aeddabfdb4be9fcbe50f48276b9ceae1127 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Mon, 25 Aug 2014 15:20:46 +1000 Subject: [PATCH] Simplify enterprise_relationship factory - leverage permissions_list= model method --- spec/factories.rb | 6 ------ spec/features/admin/enterprise_relationships_spec.rb | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/spec/factories.rb b/spec/factories.rb index 39b3a01035..849d38abf3 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -101,12 +101,6 @@ FactoryGirl.define do end factory :enterprise_relationship do - ignore { permissions [] } - after(:create) do |er, proxy| - proxy.permissions.each do |name| - er.permissions.create! name: name - end - end end factory :enterprise_role do diff --git a/spec/features/admin/enterprise_relationships_spec.rb b/spec/features/admin/enterprise_relationships_spec.rb index 7eadf37ffa..20c7b28ac2 100644 --- a/spec/features/admin/enterprise_relationships_spec.rb +++ b/spec/features/admin/enterprise_relationships_spec.rb @@ -14,9 +14,9 @@ feature %q{ scenario "listing relationships" do # Given some enterprises with relationships e1, e2, e3, e4 = create(:enterprise), create(:enterprise), create(:enterprise), create(:enterprise) - create(:enterprise_relationship, parent: e1, child: e2, permissions: [:add_products_to_order_cycle]) - create(:enterprise_relationship, parent: e2, child: e3, permissions: [:manage_products]) - create(:enterprise_relationship, parent: e3, child: e4, permissions: [:add_products_to_order_cycle, :manage_products]) + create(:enterprise_relationship, parent: e1, child: e2, permissions_list: [:add_products_to_order_cycle]) + create(:enterprise_relationship, parent: e2, child: e3, permissions_list: [:manage_products]) + create(:enterprise_relationship, parent: e3, child: e4, permissions_list: [:add_products_to_order_cycle, :manage_products]) # When I go to the relationships page click_link 'Enterprises'