diff options
author | Zeger-Jan van de Weg <zegerjan@gitlab.com> | 2016-03-18 13:28:16 +0100 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-03-18 16:58:04 -0300 |
commit | b959ae553b1243e081d557b1e545d30830931e5b (patch) | |
tree | ce6c7410a97d93645fce4eb4ae77f1e8a1f9879b /spec/services/groups/update_service_spec.rb | |
parent | 0a7f7161198feaa9a4cae7c16669a0e6187aed33 (diff) | |
download | gitlab-ce-b959ae553b1243e081d557b1e545d30830931e5b.tar.gz |
Improve group visibility level feature
Diffstat (limited to 'spec/services/groups/update_service_spec.rb')
-rw-r--r-- | spec/services/groups/update_service_spec.rb | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/spec/services/groups/update_service_spec.rb b/spec/services/groups/update_service_spec.rb index c759e32342d..9d427ff2d90 100644 --- a/spec/services/groups/update_service_spec.rb +++ b/spec/services/groups/update_service_spec.rb @@ -1,10 +1,10 @@ require 'spec_helper' describe Groups::UpdateService, services: true do - let!(:user) { create(:user) } - let!(:private_group) { create(:group, visibility_level: Gitlab::VisibilityLevel::PRIVATE) } - let!(:internal_group) { create(:group, visibility_level: Gitlab::VisibilityLevel::INTERNAL) } - let!(:public_group) { create(:group, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } + let!(:user) { create(:user) } + let!(:private_group) { create(:group, :private) } + let!(:internal_group) { create(:group, :internal) } + let!(:public_group) { create(:group, :public) } describe "execute" do context "project visibility_level validation" do @@ -14,28 +14,28 @@ describe Groups::UpdateService, services: true do before do public_group.add_user(user, Gitlab::Access::MASTER) - create(:project, :public, group: public_group, name: 'B', path: 'B') + create(:project, :public, group: public_group) end it "cant downgrade permission level" do expect(service.execute).to be_falsy - expect(public_group.errors.count).to eq(1) + expect(public_group.errors.count).to eq(2) end end - context "internal group with internal project" do - let!(:service) { described_class.new(internal_group, user, visibility_level: Gitlab::VisibilityLevel::PRIVATE ) } - - before do - internal_group.add_user(user, Gitlab::Access::MASTER) - create(:project, :internal, group: internal_group, name: 'B', path: 'B') + context "internal group with internal project" do + let!(:service) { described_class.new(internal_group, user, visibility_level: Gitlab::VisibilityLevel::PRIVATE ) } + + before do + internal_group.add_user(user, Gitlab::Access::MASTER) + create(:project, :internal, group: internal_group) + end + + it "cant downgrade permission level" do + expect(service.execute).to be_falsy + expect(internal_group.errors.count).to eq(2) + end end - - it "cant downgrade permission level" do - expect(service.execute).to be_falsy - expect(internal_group.errors.count).to eq(1) - end - end end end |