Merge branch 'ce-reduce-diff-in-spec-models' into 'master'

[CE] Reduce diff with EE in `spec/models`

See merge request gitlab-org/gitlab-ce!26847
This commit is contained in:
Lin Jen-Shin 2019-04-02 15:37:35 +00:00
commit 23c353515f
5 changed files with 42 additions and 7 deletions

View File

@ -6,14 +6,15 @@ describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
include PrometheusHelpers
include ReactiveCachingHelpers
class TestClass
include PrometheusAdapter
end
let(:project) { create(:prometheus_project) }
let(:service) { project.prometheus_service }
let(:described_class) { TestClass }
let(:described_class) do
Class.new do
include PrometheusAdapter
end
end
let(:environment_query) { Gitlab::Prometheus::Queries::EnvironmentQuery }
describe '#query' do

View File

@ -592,7 +592,9 @@ describe Environment do
shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do
it 'returns the terminals from the deployment service' do
expect(project.deployment_platform)
deployment_platform_target = Gitlab.ee? ? environment : project
expect(deployment_platform_target.deployment_platform)
.to receive(:terminals).with(environment)
.and_return(:fake_terminals)

View File

@ -2143,6 +2143,15 @@ describe Project do
expect(project.add_import_job).to eq(import_jid)
end
context 'without repository' do
it 'schedules RepositoryImportWorker' do
project = create(:project, import_url: generate(:url))
expect(RepositoryImportWorker).to receive(:perform_async).with(project.id).and_return(import_jid)
expect(project.add_import_job).to eq(import_jid)
end
end
end
context 'not forked' do

View File

@ -195,6 +195,30 @@ describe ProjectTeam do
end
end
describe '#add_users' do
let(:user1) { create(:user) }
let(:user2) { create(:user) }
let(:project) { create(:project) }
it 'add the given users to the team' do
project.team.add_users([user1, user2], :reporter)
expect(project.team.reporter?(user1)).to be(true)
expect(project.team.reporter?(user2)).to be(true)
end
end
describe '#add_user' do
let(:user) { create(:user) }
let(:project) { create(:project) }
it 'add the given user to the team' do
project.team.add_user(user, :reporter)
expect(project.team.reporter?(user)).to be(true)
end
end
describe "#human_max_access" do
it 'returns Maintainer role' do
user = create(:user)

View File

@ -1,4 +1,3 @@
# coding: utf-8
# frozen_string_literal: true
require "spec_helper"