summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorValery Sizov <vsv2711@gmail.com>2015-06-08 14:03:07 +0300
committerValery Sizov <vsv2711@gmail.com>2015-06-09 10:55:35 +0300
commitf3e9df531eba44fdccb82353045b351121ff2e93 (patch)
treeefebc45dbdf5ab76e5a51c5a5983b223b330f284 /spec
parent36dbe836bdf65563ee04dd4a819f8ccef5c9b831 (diff)
downloadgitlab-ci-f3e9df531eba44fdccb82353045b351121ff2e93.tar.gz
Fix of creation project with the same name
Diffstat (limited to 'spec')
-rw-r--r--spec/factories/projects.rb2
-rw-r--r--spec/features/runners_spec.rb6
-rw-r--r--spec/support/stub_gitlab_calls.rb14
3 files changed, 11 insertions, 11 deletions
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