diff --git a/app/models/ability.rb b/app/models/ability.rb index e166b4197fd..4e6c60dc8ca 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -115,7 +115,7 @@ class Ability end unless project.snippets_enabled - rules -= named_abilities('snippet') + rules -= named_abilities('project_snippet') end unless project.wiki_enabled diff --git a/features/project/project.feature b/features/project/project.feature index ef11bceed11..56ae5c78d01 100644 --- a/features/project/project.feature +++ b/features/project/project.feature @@ -68,3 +68,8 @@ Feature: Project When I visit project "Shop" page Then I should not see "New Issue" button And I should not see "New Merge Request" button + + Scenario: I should not see Project snippets + Given I disable snippets in project + When I visit project "Shop" page + Then I should not see "Snippets" button diff --git a/features/steps/project/project.rb b/features/steps/project/project.rb index 93fea693f89..fcc15aacc21 100644 --- a/features/steps/project/project.rb +++ b/features/steps/project/project.rb @@ -110,4 +110,8 @@ class Spinach::Features::Project < Spinach::FeatureSteps step 'I should not see "New Merge Request" button' do page.should_not have_link 'New Merge Request' end + + step 'I should not see "Snippets" button' do + page.should_not have_link 'Snippets' + end end diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb index 24136fe421c..3059c4ee041 100644 --- a/features/steps/shared/project.rb +++ b/features/steps/shared/project.rb @@ -14,6 +14,11 @@ module SharedProject @project.team << [@user, :master] end + step 'I disable snippets in project' do + @project.snippets_enabled = false + @project.save + end + step 'I disable issues and merge requests in project' do @project.issues_enabled = false @project.merge_requests_enabled = false