diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-08-26 23:20:00 +0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2016-08-26 23:20:00 +0300 |
commit | 6686084c6502f10fd7e6b8963ab52526cb6831bf (patch) | |
tree | 7d15178ef2e6097671b869cf3749897089d514b5 /spec/models | |
parent | 0e3c7b2f2a5742216eda2d2cf6df9a5ea5f866ff (diff) |
Fix "Wiki" link not appearing in navigation for projects with external wiki
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/ability_spec.rb | 13 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 12 |
2 files changed, 25 insertions, 0 deletions
diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index aa3b2bbf471..c50ca38bdd9 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -282,4 +282,17 @@ describe Ability, lib: true do end end end + + describe '.project_disabled_features_rules' do + let(:project) { build(:project) } + + subject { described_class.project_disabled_features_rules(project) } + + context 'wiki named abilities' do + it 'disables wiki abilities if the project has no wiki' do + expect(project).to receive(:has_wiki?).and_return(false) + expect(subject).to include(:read_wiki, :create_wiki, :update_wiki, :admin_wiki) + end + end + end end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index b2baeeb31bb..3b637b0defc 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -506,6 +506,18 @@ describe Project, models: true do end end + describe '#has_wiki?' do + let(:no_wiki_project) { build(:project, wiki_enabled: false, has_external_wiki: false) } + let(:wiki_enabled_project) { build(:project, wiki_enabled: true) } + let(:external_wiki_project) { build(:project, has_external_wiki: true) } + + it 'returns true if project is wiki enabled or has external wiki' do + expect(wiki_enabled_project).to have_wiki + expect(external_wiki_project).to have_wiki + expect(no_wiki_project).not_to have_wiki + end + end + describe '#external_wiki' do let(:project) { create(:project) } |