aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib
diff options
context:
space:
mode:
authorZog2018-01-17 09:43:37 +0100
committerZog2018-01-25 17:17:59 +0100
commitb802b16973bbf760aa8af720856c4127656c2e07 (patch)
tree7e42ad87b056fbe88b62189cc2023b200127599d /spec/lib
parent377ddcd306fb9e61e734aaf3762e05f448938af0 (diff)
downloadchouette-core-b802b16973bbf760aa8af720856c4127656c2e07.tar.bz2
Refs #5586; Add a `feature` option on the `action_links`
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/af83/decorator/decorator_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/lib/af83/decorator/decorator_spec.rb b/spec/lib/af83/decorator/decorator_spec.rb
index 789813063..32c76c22f 100644
--- a/spec/lib/af83/decorator/decorator_spec.rb
+++ b/spec/lib/af83/decorator/decorator_spec.rb
@@ -308,6 +308,38 @@ RSpec.describe AF83::Decorator, type: :decorator do
end
end
+ context "with a feature" do
+ let(:decorator) do
+ klass = Class.new(AF83::Decorator)
+ klass.with_instance_decorator do |instance_decorator|
+ instance_decorator.action_link href: "foo", content: "foo", feature: :foo
+ end
+ klass
+ end
+
+ context "when the feature is not present" do
+ before(:each) do
+ Draper::HelperProxy.any_instance.stub(:has_feature?){false}
+ end
+
+ it "should not return the link" do
+ links = decorated.action_links(:show)
+ expect(links.size).to eq 0
+ end
+ end
+
+ context "when the feature is present" do
+ before(:each) do
+ Draper::HelperProxy.any_instance.stub(:has_feature?){true}
+ end
+
+ it "should not return the link" do
+ links = decorated.action_links(:show)
+ expect(links.size).to eq 1
+ end
+ end
+ end
+
context "with a condition" do
context "set with 'with_condition'" do
context "as a value" do