diff options
Diffstat (limited to 'spec/services/ci/create_project_service_spec.rb')
-rw-r--r-- | spec/services/ci/create_project_service_spec.rb | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/spec/services/ci/create_project_service_spec.rb b/spec/services/ci/create_project_service_spec.rb index ce5b131f192..9f464d20fe7 100644 --- a/spec/services/ci/create_project_service_spec.rb +++ b/spec/services/ci/create_project_service_spec.rb @@ -3,14 +3,14 @@ require 'spec_helper' describe Ci::CreateProjectService do let(:service) { Ci::CreateProjectService.new } let(:current_user) { double.as_null_object } - let(:project_dump) { YAML.load File.read(Rails.root.join('spec/support/gitlab_stubs/raw_project.yml')) } + let(:project) { FactoryGirl.create :project } describe :execute do context 'valid params' do - let(:project) { service.execute(current_user, project_dump, 'http://localhost/projects/:project_id') } + subject { service.execute(current_user, project, 'http://localhost/projects/:project_id') } - it { expect(project).to be_kind_of(Project) } - it { expect(project).to be_persisted } + it { is_expected.to be_kind_of(Ci::Project) } + it { is_expected.to be_persisted } end context 'without project dump' do @@ -20,18 +20,16 @@ describe Ci::CreateProjectService do end context "forking" do - it "uses project as a template for settings and jobs" do - origin_project = FactoryGirl.create(:ci_project) - origin_project.shared_runners_enabled = true - origin_project.public = true - origin_project.allow_git_fetch = true - origin_project.save! + let (:ci_origin_project) { + FactoryGirl.create(:ci_project, shared_runners_enabled: true, public: true, allow_git_fetch: true) + } - project = service.execute(current_user, project_dump, 'http://localhost/projects/:project_id', origin_project) + subject { service.execute(current_user, project, 'http://localhost/projects/:project_id', ci_origin_project) } - expect(project.shared_runners_enabled).to be_truthy - expect(project.public).to be_truthy - expect(project.allow_git_fetch).to be_truthy + it "uses project as a template for settings and jobs" do + expect(subject.shared_runners_enabled).to be_truthy + expect(subject.public).to be_truthy + expect(subject.allow_git_fetch).to be_truthy end end end |