diff options
| author | Zog | 2018-01-22 09:54:20 +0100 |
|---|---|---|
| committer | Zog | 2018-01-25 17:18:01 +0100 |
| commit | ff5d96b530a41669c394b7b0dc138e29da48e97d (patch) | |
| tree | cc731e14383ef8f47302478faebac493dadacdf8 /spec/support | |
| parent | 872f9476971d3bde6e6f470153af09ed87af1b28 (diff) | |
| download | chouette-core-ff5d96b530a41669c394b7b0dc138e29da48e97d.tar.bz2 | |
Refs #5586 @2h; Fix specs
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/decorator_helpers.rb | 23 |
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 |
