diff options
| author | Alban Peignier | 2017-12-19 19:42:52 +0100 |
|---|---|---|
| committer | Alban Peignier | 2017-12-20 17:23:47 +0100 |
| commit | f31a79c5bc3678949b7334486daa196a17a5db92 (patch) | |
| tree | 49cbd986ede79cc5a3ec6811bf07db87320f99f8 /spec/models/organisation_spec.rb | |
| parent | 86bdefb0483a8409810715c3cdc65b9a178a2667 (diff) | |
| download | chouette-core-f31a79c5bc3678949b7334486daa196a17a5db92.tar.bz2 | |
Create Organisation#features and FeatureChecker controller concerns. Refs #5339
Diffstat (limited to 'spec/models/organisation_spec.rb')
| -rw-r--r-- | spec/models/organisation_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index 359417d88..0d54ed143 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 true if Organisation features doesn't contains given feature" do + organisation.features = %w{other} + expect(organisation.has_feature?(:absent)).to be_falsy + end + + end + end |
