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:
commit
23c353515f
|
@ -6,14 +6,15 @@ describe PrometheusAdapter, :use_clean_rails_memory_store_caching do
|
||||||
include PrometheusHelpers
|
include PrometheusHelpers
|
||||||
include ReactiveCachingHelpers
|
include ReactiveCachingHelpers
|
||||||
|
|
||||||
class TestClass
|
|
||||||
include PrometheusAdapter
|
|
||||||
end
|
|
||||||
|
|
||||||
let(:project) { create(:prometheus_project) }
|
let(:project) { create(:prometheus_project) }
|
||||||
let(:service) { project.prometheus_service }
|
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 }
|
let(:environment_query) { Gitlab::Prometheus::Queries::EnvironmentQuery }
|
||||||
|
|
||||||
describe '#query' do
|
describe '#query' do
|
||||||
|
|
|
@ -592,7 +592,9 @@ describe Environment do
|
||||||
|
|
||||||
shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do
|
shared_examples 'same behavior between KubernetesService and Platform::Kubernetes' do
|
||||||
it 'returns the terminals from the deployment service' 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)
|
.to receive(:terminals).with(environment)
|
||||||
.and_return(:fake_terminals)
|
.and_return(:fake_terminals)
|
||||||
|
|
||||||
|
|
|
@ -2143,6 +2143,15 @@ describe Project do
|
||||||
|
|
||||||
expect(project.add_import_job).to eq(import_jid)
|
expect(project.add_import_job).to eq(import_jid)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
context 'not forked' do
|
context 'not forked' do
|
||||||
|
|
|
@ -195,6 +195,30 @@ describe ProjectTeam do
|
||||||
end
|
end
|
||||||
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
|
describe "#human_max_access" do
|
||||||
it 'returns Maintainer role' do
|
it 'returns Maintainer role' do
|
||||||
user = create(:user)
|
user = create(:user)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# coding: utf-8
|
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "spec_helper"
|
require "spec_helper"
|
||||||
|
|
Loading…
Reference in New Issue