aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/decorator_helpers.rb23
1 files changed, 18 insertions, 5 deletions
diff --git a/spec/support/decorator_helpers.rb b/spec/support/decorator_helpers.rb
index 9d450deb1..b2c41e842 100644
--- a/spec/support/decorator_helpers.rb
+++ b/spec/support/decorator_helpers.rb
@@ -5,18 +5,31 @@ module Support
subject{ object.decorate }
let( :policy ){ ::Pundit.policy(user_context, object) }
let( :user_context ){ UserContext.new(user, referential: referential) }
-
+ let( :features ){ [] }
+ let( :filtered_action_links){}
before do
allow_any_instance_of(Draper::HelperProxy).to receive(:policy).and_return policy
+ allow_any_instance_of(AF83::Decorator::Link).to receive(:check_feature){|f|
+ features.include?(f)
+ }
end
end
end
- def expect_action_link_hrefs
- expect( subject.action_links.select(&Link.method(:===)).map(&:href) )
+ def expect_action_link_hrefs(action=:index)
+ if subject.action_links.is_a? AF83::Decorator::ActionLinks
+ expect( subject.action_links(action).map(&:href) )
+ else
+ expect( subject.action_links.select(&Link.method(:===)).map(&:href) )
+ end
end
- def expect_action_link_elements
- expect( subject.action_links.select(&HTMLElement.method(:===)).map(&:content) )
+
+ def expect_action_link_elements(action=:index)
+ if subject.action_links.is_a? AF83::Decorator::ActionLinks
+ expect( subject.action_links(action).map(&:content) )
+ else
+ expect( subject.action_links.select(&HTMLElement.method(:===)).map(&:content) )
+ end
end
end
end