diff options
Diffstat (limited to 'spec/requests/ci/api')
-rw-r--r-- | spec/requests/ci/api/builds_spec.rb | 24 | ||||
-rw-r--r-- | spec/requests/ci/api/projects_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/ci/api/triggers_spec.rb | 4 |
3 files changed, 15 insertions, 15 deletions
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb index 61f9d940c3b..c25d1823306 100644 --- a/spec/requests/ci/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -11,7 +11,7 @@ describe Ci::API::API do let(:shared_project) { FactoryGirl.create(:ci_project, name: "SharedProject") } before do - FactoryGirl.create :runner_project, project_id: project.id, runner_id: runner.id + FactoryGirl.create :ci_runner_project, project_id: project.id, runner_id: runner.id end describe "POST /builds/register" do @@ -20,7 +20,7 @@ describe Ci::API::API do commit.create_builds build = commit.builds.first - post api("/builds/register"), token: runner.token, info: { platform: :darwin } + post ci_api("/builds/register"), token: runner.token, info: { platform: :darwin } expect(response.status).to eq(201) expect(json_response['sha']).to eq(build.sha) @@ -28,7 +28,7 @@ describe Ci::API::API do end it "should return 404 error if no pending build found" do - post api("/builds/register"), token: runner.token + post ci_api("/builds/register"), token: runner.token expect(response.status).to eq(404) end @@ -37,7 +37,7 @@ describe Ci::API::API do commit = FactoryGirl.create(:ci_commit, project: shared_project) FactoryGirl.create(:ci_build, commit: commit, status: 'pending' ) - post api("/builds/register"), token: runner.token + post ci_api("/builds/register"), token: runner.token expect(response.status).to eq(404) end @@ -46,7 +46,7 @@ describe Ci::API::API do commit = FactoryGirl.create(:ci_commit, project: project) FactoryGirl.create(:ci_build, commit: commit, status: 'pending' ) - post api("/builds/register"), token: shared_runner.token + post ci_api("/builds/register"), token: shared_runner.token expect(response.status).to eq(404) end @@ -55,7 +55,7 @@ describe Ci::API::API do commit = FactoryGirl.create(:ci_commit, project: project) commit.create_builds - post api("/builds/register"), token: runner.token, info: { platform: :darwin } + post ci_api("/builds/register"), token: runner.token, info: { platform: :darwin } expect(response.status).to eq(201) expect(json_response["options"]).to eq({ "image" => "ruby:2.1", "services" => ["postgres"] }) @@ -64,9 +64,9 @@ describe Ci::API::API do it "returns variables" do commit = FactoryGirl.create(:ci_commit, project: project) commit.create_builds - project.variables << Variable.new(key: "SECRET_KEY", value: "secret_value") + project.variables << Ci::Variable.new(key: "SECRET_KEY", value: "secret_value") - post api("/builds/register"), token: runner.token, info: { platform: :darwin } + post ci_api("/builds/register"), token: runner.token, info: { platform: :darwin } expect(response.status).to eq(201) expect(json_response["variables"]).to eq([ @@ -81,9 +81,9 @@ describe Ci::API::API do trigger_request = FactoryGirl.create(:ci_trigger_request_with_variables, commit: commit, trigger: trigger) commit.create_builds(trigger_request) - project.variables << Variable.new(key: "SECRET_KEY", value: "secret_value") + project.variables << Ci::Variable.new(key: "SECRET_KEY", value: "secret_value") - post api("/builds/register"), token: runner.token, info: { platform: :darwin } + post ci_api("/builds/register"), token: runner.token, info: { platform: :darwin } expect(response.status).to eq(201) expect(json_response["variables"]).to eq([ @@ -100,14 +100,14 @@ describe Ci::API::API do it "should update a running build" do build.run! - put api("/builds/#{build.id}"), token: runner.token + put ci_api("/builds/#{build.id}"), token: runner.token expect(response.status).to eq(200) end it 'Should not override trace information when no trace is given' do build.run! build.update!(trace: 'hello_world') - put api("/builds/#{build.id}"), token: runner.token + put ci_api("/builds/#{build.id}"), token: runner.token expect(build.reload.trace).to eq 'hello_world' end end diff --git a/spec/requests/ci/api/projects_spec.rb b/spec/requests/ci/api/projects_spec.rb index a0072b62fbf..2adae52e79e 100644 --- a/spec/requests/ci/api/projects_spec.rb +++ b/spec/requests/ci/api/projects_spec.rb @@ -62,7 +62,7 @@ describe Ci::API::API do let!(:project) { FactoryGirl.create(:ci_project) } context "Valid Webhook URL" do - let!(:webhook) { {web_hook: "http://example.com/sth/1/ala_ma_kota" } } + let!(:webhook) { { web_hook: "http://example.com/sth/1/ala_ma_kota" } } before do options.merge!(webhook) diff --git a/spec/requests/ci/api/triggers_spec.rb b/spec/requests/ci/api/triggers_spec.rb index 97847bec2af..ff6fdbdd6f1 100644 --- a/spec/requests/ci/api/triggers_spec.rb +++ b/spec/requests/ci/api/triggers_spec.rb @@ -8,11 +8,11 @@ describe Ci::API::API do let!(:project) { FactoryGirl.create(:ci_project) } let!(:project2) { FactoryGirl.create(:ci_project) } let!(:trigger) { FactoryGirl.create(:ci_trigger, project: project, token: trigger_token) } - let(:options) { + let(:options) do { token: trigger_token } - } + end context 'Handles errors' do it 'should return bad request if token is missing' do |