diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | app/models/project.rb | 2 | ||||
-rw-r--r-- | config/environments/test.rb | 1 | ||||
-rw-r--r-- | spec/factories/projects.rb | 2 | ||||
-rw-r--r-- | spec/features/runners_spec.rb | 6 | ||||
-rw-r--r-- | spec/support/stub_gitlab_calls.rb | 14 |
6 files changed, 14 insertions, 12 deletions
@@ -9,6 +9,7 @@ v7.12.0 - Ability to set secret variables for runner - Dont retry build when push same commit in same ref twice - Admin area: show amount of runners with last contact less than a minute ago + - Fix re-adding project with the same name but different gitlab_id v7.11.0 - Deploy Jobs API calls diff --git a/app/models/project.rb b/app/models/project.rb index 308fde4..f103a88 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -49,7 +49,7 @@ class Project < ActiveRecord::Base validates_presence_of :name, :timeout, :token, :default_ref, :path, :ssh_url_to_repo, :gitlab_id - validates_uniqueness_of :name + validates_uniqueness_of :gitlab_id validates :polling_interval, presence: true, diff --git a/config/environments/test.rb b/config/environments/test.rb index 70607d3..00a6495 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -30,4 +30,5 @@ GitlabCi::Application.configure do config.active_support.deprecation = :stderr config.eager_load = false + config.cache_store = :null_store end diff --git a/spec/factories/projects.rb b/spec/factories/projects.rb index f571587..f6cef2d 100644 --- a/spec/factories/projects.rb +++ b/spec/factories/projects.rb @@ -42,7 +42,7 @@ FactoryGirl.define do "git@demo.gitlab.com:gitlab/gitlab-shell#{n}.git" end - gitlab_id 8 + sequence :gitlab_id factory :project do token 'iPWx6WM4lhHNedGfBpPJNP' diff --git a/spec/features/runners_spec.rb b/spec/features/runners_spec.rb index c312f83..c41dc5b 100644 --- a/spec/features/runners_spec.rb +++ b/spec/features/runners_spec.rb @@ -11,6 +11,12 @@ describe "Runners" do @project2 = FactoryGirl.create :project stub_js_gitlab_calls + # all projects should be authorized for user + Network.any_instance.stub(:projects).and_return([ + OpenStruct.new({id: @project.gitlab_id}), + OpenStruct.new({id: @project2.gitlab_id}) + ]) + @shared_runner = FactoryGirl.create :shared_runner @specific_runner = FactoryGirl.create :specific_runner @specific_runner2 = FactoryGirl.create :specific_runner diff --git a/spec/support/stub_gitlab_calls.rb b/spec/support/stub_gitlab_calls.rb index 286c6c9..f378219 100644 --- a/spec/support/stub_gitlab_calls.rb +++ b/spec/support/stub_gitlab_calls.rb @@ -46,19 +46,13 @@ module StubGitlabCalls end def stub_project_8 - f = File.read(Rails.root.join('spec/support/gitlab_stubs/project_8.json')) - - stub_request(:get, "#{gitlab_url}api/v3/projects/8.json?private_token=Wvjy2Krpb7y8xi93owUz"). - with(:headers => {'Content-Type'=>'application/json'}). - to_return(:status => 200, :body => f, :headers => {'Content-Type'=>'application/json'}) + data = File.read(Rails.root.join('spec/support/gitlab_stubs/project_8.json')) + Network.any_instance.stub(:project).and_return(JSON.parse(data)) end def stub_project_8_hooks - f = File.read(Rails.root.join('spec/support/gitlab_stubs/project_8_hooks.json')) - - stub_request(:get, "#{gitlab_url}api/v3/projects/8/hooks.json?private_token=Wvjy2Krpb7y8xi93owUz"). - with(:headers => {'Content-Type'=>'application/json'}). - to_return(:status => 200, :body => f, :headers => {'Content-Type'=>'application/json'}) + data = File.read(Rails.root.join('spec/support/gitlab_stubs/project_8_hooks.json')) + Network.any_instance.stub(:project_hooks).and_return(JSON.parse(data)) end def stub_projects |