diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-03-18 15:28:16 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-03-18 22:58:04 +0300 |
commit | b959ae553b1243e081d557b1e545d30830931e5b (patch) | |
tree | ce6c7410a97d93645fce4eb4ae77f1e8a1f9879b /spec/models | |
parent | 0a7f7161198feaa9a4cae7c16669a0e6187aed33 (diff) |
Improve group visibility level feature
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/group_spec.rb | 10 | ||||
-rw-r--r-- | spec/models/project_spec.rb | 8 |
2 files changed, 7 insertions, 11 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 135d298e10f..0591aa089d8 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -57,18 +57,18 @@ describe Group, models: true do end describe 'scopes' do - let!(:private_group) { create(:group, visibility_level: 0) } - let!(:internal_group) { create(:group, visibility_level: 10) } - let!(:public_group) { create(:group, visibility_level: 20) } + let!(:private_group) { create(:group, :private) } + let!(:internal_group) { create(:group, :internal) } + let!(:public_group) { create(:group, :public) } describe 'public_only' do - subject { described_class.public_only } + subject { described_class.public_only.to_a } it{ is_expected.to eq([public_group]) } end describe 'public_and_internal_only' do - subject { described_class.public_and_internal_only } + subject { described_class.public_and_internal_only.to_a } it{ is_expected.to eq([public_group, internal_group]) } end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 7fd3726c6ad..74383204250 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -571,12 +571,8 @@ describe Project, models: true do end context 'when checking on forked project' do - let(:forked_project) { create :forked_project_with_submodules } - - before do - forked_project.build_forked_project_link(forked_to_project_id: forked_project.id, forked_from_project_id: project.id) - forked_project.save - end + let(:project) { create(:project, :internal) } + let(:forked_project) { create(:project, forked_from_project: project) } it { expect(forked_project.visibility_level_allowed?(Gitlab::VisibilityLevel::PRIVATE)).to be_truthy } it { expect(forked_project.visibility_level_allowed?(Gitlab::VisibilityLevel::INTERNAL)).to be_truthy } |