Commit 23c35351 authored by Lin Jen-Shin's avatar Lin Jen-Shin

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
parents 3d24e722 8708c720
......@@ -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
......
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
# coding: utf-8
# frozen_string_literal: true
require "spec_helper"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment