aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models/organisation_spec.rb
diff options
context:
space:
mode:
authorAlban Peignier2017-12-20 21:30:22 +0100
committerGitHub2017-12-20 21:30:22 +0100
commit6b4b00a57d2c96ea9f2c663dd9892ccdd4fdbd29 (patch)
treea7f69ebd48e32bf14d2da6ba47c84a8e2e57aae2 /spec/models/organisation_spec.rb
parent0a1e40a31c27c59018cbdb8821b530ccfd59b878 (diff)
parent462c1c257e954c77f1dedfc770d3c78111c1b499 (diff)
downloadchouette-core-6b4b00a57d2c96ea9f2c663dd9892ccdd4fdbd29.tar.bz2
Merge pull request #164 from af83/5339-organisation-and-features
Create Organisation#features and FeatureChecker. Refs #5339
Diffstat (limited to 'spec/models/organisation_spec.rb')
-rw-r--r--spec/models/organisation_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb
index 359417d88..595b08058 100644
--- a/spec/models/organisation_spec.rb
+++ b/spec/models/organisation_spec.rb
@@ -62,4 +62,26 @@ describe Organisation, :type => :model do
expect{Organisation.portail_sync}.to change{ Organisation.count }.by(4)
end
end
+
+ describe "#has_feature?" do
+
+ let(:organisation) { Organisation.new }
+
+ it 'return false if Organisation features is nil' do
+ organisation.features = nil
+ expect(organisation.has_feature?(:dummy)).to be_falsy
+ end
+
+ it 'return true if Organisation features contains given feature' do
+ organisation.features = %w{present}
+ expect(organisation.has_feature?(:present)).to be_truthy
+ end
+
+ it "return false if Organisation features doesn't contains given feature" do
+ organisation.features = %w{other}
+ expect(organisation.has_feature?(:absent)).to be_falsy
+ end
+
+ end
+
end