diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/helpers/projects_helper_spec.rb | 10 | ||||
-rw-r--r-- | spec/models/group_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/groups/update_service_spec.rb | 11 |
3 files changed, 10 insertions, 15 deletions
diff --git a/spec/helpers/projects_helper_spec.rb b/spec/helpers/projects_helper_spec.rb index 53207767581..dc324f1e60e 100644 --- a/spec/helpers/projects_helper_spec.rb +++ b/spec/helpers/projects_helper_spec.rb @@ -11,16 +11,8 @@ describe ProjectsHelper do describe "can_change_visibility_level?" do let(:project) { create(:project) } - - let(:fork_project) do - fork_project = create(:forked_project_with_submodules) - fork_project.build_forked_project_link(forked_to_project_id: fork_project.id, forked_from_project_id: project.id) - fork_project.save - - fork_project - end - let(:user) { create(:user) } + let(:fork_project) { Projects::ForkService.new(project, user).execute } it "returns false if there are no appropriate permissions" do allow(helper).to receive(:can?) { false } diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index 208922b5a8e..68e213f4816 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -67,9 +67,9 @@ describe Group, models: true do end describe 'public_and_internal_only' do - subject { described_class.public_and_internal_only.to_a } + subject { described_class.public_and_internal_only.to_a.sort } - it{ is_expected.to eq([group, internal_group]) } + it{ is_expected.to eq([group, internal_group].sort) } end end diff --git a/spec/services/groups/update_service_spec.rb b/spec/services/groups/update_service_spec.rb index 7732482cdaa..9c2331144a0 100644 --- a/spec/services/groups/update_service_spec.rb +++ b/spec/services/groups/update_service_spec.rb @@ -16,8 +16,9 @@ describe Groups::UpdateService, services: true do create(:project, :public, group: public_group) end - it "cant downgrade permission level" do - expect(public_group.errors.count).to eq(2) + it "does not change permission level" do + service.execute + expect(public_group.errors.count).to eq(1) end end @@ -29,8 +30,9 @@ describe Groups::UpdateService, services: true do create(:project, :internal, group: internal_group) end - it "cant downgrade permission level" do - expect(internal_group.errors.count).to eq(2) + it "does not change permission level" do + service.execute + expect(internal_group.errors.count).to eq(1) end end end @@ -43,6 +45,7 @@ describe Groups::UpdateService, services: true do end it "does not change permission level" do + service.execute expect(internal_group.errors.count).to eq(1) end end |