summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2015-09-24 19:41:58 +0000
committerRobert Speicher <robert@gitlab.com>2015-09-24 19:41:58 +0000
commit817a60894a8cb37539c9225b6619083100bc75fc (patch)
tree24fea3323d0baffa9a9602e4c80a51afa0052e6b /spec
parent83c9752e04c3d1040191fc68817c0e2a6058a7e3 (diff)
parent04c4445ae088f2599659522c70a096811ecd0496 (diff)
downloadgitlab-ce-817a60894a8cb37539c9225b6619083100bc75fc.tar.gz
Merge branch 'get-ci-token-from-ci-projects' into 'master'
Get CI token from ci projects This fixes problem when GitLabCiService had different token than stored in Ci::Project. See merge request !1425
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/backend/grack_auth_spec.rb5
-rw-r--r--spec/requests/api/projects_spec.rb2
2 files changed, 5 insertions, 2 deletions
diff --git a/spec/lib/gitlab/backend/grack_auth_spec.rb b/spec/lib/gitlab/backend/grack_auth_spec.rb
index 9bed8f8ee5c..829a9c197ef 100644
--- a/spec/lib/gitlab/backend/grack_auth_spec.rb
+++ b/spec/lib/gitlab/backend/grack_auth_spec.rb
@@ -175,11 +175,14 @@ describe Grack::Auth do
context "when a gitlab ci token is provided" do
let(:token) { "123" }
+ let(:gitlab_ci_project) { FactoryGirl.create :ci_project, token: token }
before do
+ project.gitlab_ci_project = gitlab_ci_project
+ project.save
+
gitlab_ci_service = project.build_gitlab_ci_service
gitlab_ci_service.active = true
- gitlab_ci_service.token = token
gitlab_ci_service.save
env["HTTP_AUTHORIZATION"] = ActionController::HttpAuthentication::Basic.encode_credentials("gitlab-ci-token", token)
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 3007a15b0b1..580bbec77d1 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -89,7 +89,7 @@ describe API::API, api: true do
it 'returns projects in the correct order when ci_enabled_first parameter is passed' do
[project, project2, project3].each{ |project| project.build_missing_services }
- project2.gitlab_ci_service.update(active: true, token: "token")
+ project2.gitlab_ci_service.update(active: true)
get api('/projects', user), { ci_enabled_first: 'true' }
expect(response.status).to eq(200)
expect(json_response).to be_an Array