diff options
author | Tuomo Ala-Vannesluoma <tuomoav@gmail.com> | 2018-10-05 16:41:11 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-10-05 16:41:11 +0300 |
commit | c84b60b1645950a30fdbc37c9065a200dc750d90 (patch) | |
tree | 76d523f37481fa1422f63e96e2a1777d48060b9c /spec/models | |
parent | c972f2e459a6b45852a3d4e76566cdf772a6764a (diff) |
Make GitLab pages support access control
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/internal_id_spec.rb | 3 | ||||
-rw-r--r-- | spec/models/project_feature_spec.rb | 15 |
2 files changed, 16 insertions, 2 deletions
diff --git a/spec/models/internal_id_spec.rb b/spec/models/internal_id_spec.rb index f2aad455d5f..52c00a74b4b 100644 --- a/spec/models/internal_id_spec.rb +++ b/spec/models/internal_id_spec.rb @@ -65,7 +65,8 @@ describe InternalId do context 'with an insufficient schema version' do before do described_class.reset_column_information - expect(ActiveRecord::Migrator).to receive(:current_version).and_return(InternalId::REQUIRED_SCHEMA_VERSION - 1) + # Project factory will also call the current_version + expect(ActiveRecord::Migrator).to receive(:current_version).twice.and_return(InternalId::REQUIRED_SCHEMA_VERSION - 1) end let(:init) { double('block') } diff --git a/spec/models/project_feature_spec.rb b/spec/models/project_feature_spec.rb index 2a193864e46..fee7d65c217 100644 --- a/spec/models/project_feature_spec.rb +++ b/spec/models/project_feature_spec.rb @@ -17,7 +17,7 @@ describe ProjectFeature do end describe '#feature_available?' do - let(:features) { %w(issues wiki builds merge_requests snippets repository) } + let(:features) { %w(issues wiki builds merge_requests snippets repository pages) } context 'when features are disabled' do it "returns false" do @@ -112,6 +112,19 @@ describe ProjectFeature do end end + context 'public features' do + it "does not allow public for other than pages" do + features = %w(issues wiki builds merge_requests snippets repository) + project_feature = project.project_feature + + features.each do |feature| + field = "#{feature}_access_level".to_sym + project_feature.update_attribute(field, ProjectFeature::PUBLIC) + expect(project_feature.valid?).to be_falsy + end + end + end + describe '#*_enabled?' do let(:features) { %w(wiki builds merge_requests) } |