diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-10 17:04:06 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-09-10 17:04:06 +0300 |
commit | 9d93c567b39bc4f3e6737f1db5b1c6c2b1d59654 (patch) | |
tree | 83b5425885bd4a0785f109b631c5bdd850333031 /spec/requests | |
parent | bf8013f1a4c5d6274d0b03f55098e3b4d1da3f4d (diff) |
Fix part of CI api tests
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/ci/api/builds_spec.rb | 62 | ||||
-rw-r--r-- | spec/requests/ci/api/commits_spec.rb | 20 | ||||
-rw-r--r-- | spec/requests/ci/api/forks_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/ci/api/projects_spec.rb | 102 | ||||
-rw-r--r-- | spec/requests/ci/api/runners_spec.rb | 36 | ||||
-rw-r--r-- | spec/requests/ci/api/triggers_spec.rb | 34 | ||||
-rw-r--r-- | spec/requests/ci/builds_spec.rb | 10 | ||||
-rw-r--r-- | spec/requests/ci/commits_spec.rb | 8 |
8 files changed, 140 insertions, 140 deletions
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb index 7da212da83a..c416ca98e1f 100644 --- a/spec/requests/ci/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -3,12 +3,12 @@ require 'spec_helper' describe Ci::API::API do include ApiHelpers - let(:runner) { FactoryGirl.create(:runner, tag_list: ["mysql", "ruby"]) } - let(:project) { FactoryGirl.create(:project) } + let(:runner) { FactoryGirl.create(:ci_runner, tag_list: ["mysql", "ruby"]) } + let(:project) { FactoryGirl.create(:ci_project) } describe "Builds API for runners" do - let(:shared_runner) { FactoryGirl.create(:runner, token: "SharedRunner") } - let(:shared_project) { FactoryGirl.create(:project, name: "SharedProject") } + let(:shared_runner) { FactoryGirl.create(:ci_runner, token: "SharedRunner") } + let(:shared_project) { FactoryGirl.create(:ci_project, name: "SharedProject") } before do FactoryGirl.create :runner_project, project_id: project.id, runner_id: runner.id @@ -16,92 +16,92 @@ describe Ci::API::API do describe "POST /builds/register" do it "should start a build" do - commit = FactoryGirl.create(:commit, project: project) + commit = FactoryGirl.create(:ci_commit, project: project) commit.create_builds build = commit.builds.first post api("/builds/register"), token: runner.token, info: {platform: :darwin} - response.status.should == 201 - json_response['sha'].should == build.sha - runner.reload.platform.should == "darwin" + expect(response.status).to eq(201) + expect(json_response['sha']).to eq(build.sha) + expect(runner.reload.platform).to eq("darwin") end it "should return 404 error if no pending build found" do post api("/builds/register"), token: runner.token - response.status.should == 404 + expect(response.status).to eq(404) end it "should return 404 error if no builds for specific runner" do - commit = FactoryGirl.create(:commit, project: shared_project) - FactoryGirl.create(:build, commit: commit, status: 'pending' ) + commit = FactoryGirl.create(:ci_commit, project: shared_project) + FactoryGirl.create(:ci_build, commit: commit, status: 'pending' ) post api("/builds/register"), token: runner.token - response.status.should == 404 + expect(response.status).to eq(404) end it "should return 404 error if no builds for shared runner" do - commit = FactoryGirl.create(:commit, project: project) - FactoryGirl.create(:build, commit: commit, status: 'pending' ) + commit = FactoryGirl.create(:ci_commit, project: project) + FactoryGirl.create(:ci_build, commit: commit, status: 'pending' ) post api("/builds/register"), token: shared_runner.token - response.status.should == 404 + expect(response.status).to eq(404) end it "returns options" do - commit = FactoryGirl.create(:commit, project: project) + commit = FactoryGirl.create(:ci_commit, project: project) commit.create_builds post api("/builds/register"), token: runner.token, info: {platform: :darwin} - response.status.should == 201 - json_response["options"].should == {"image" => "ruby:2.1", "services" => ["postgres"]} + expect(response.status).to eq(201) + expect(json_response["options"]).to eq({"image" => "ruby:2.1", "services" => ["postgres"]}) end it "returns variables" do - commit = FactoryGirl.create(:commit, project: project) + commit = FactoryGirl.create(:ci_commit, project: project) commit.create_builds project.variables << Variable.new(key: "SECRET_KEY", value: "secret_value") post api("/builds/register"), token: runner.token, info: {platform: :darwin} - response.status.should == 201 - json_response["variables"].should == [ + expect(response.status).to eq(201) + expect(json_response["variables"]).to eq([ {"key" => "DB_NAME", "value" => "postgres", "public" => true}, {"key" => "SECRET_KEY", "value" => "secret_value", "public" => false}, - ] + ]) end it "returns variables for triggers" do - trigger = FactoryGirl.create(:trigger, project: project) - commit = FactoryGirl.create(:commit, project: project) + trigger = FactoryGirl.create(:ci_trigger, project: project) + commit = FactoryGirl.create(:ci_commit, project: project) - trigger_request = FactoryGirl.create(:trigger_request_with_variables, commit: commit, trigger: trigger) + 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") post api("/builds/register"), token: runner.token, info: {platform: :darwin} - response.status.should == 201 - json_response["variables"].should == [ + expect(response.status).to eq(201) + expect(json_response["variables"]).to eq([ {"key" => "DB_NAME", "value" => "postgres", "public" => true}, {"key" => "SECRET_KEY", "value" => "secret_value", "public" => false}, {"key" => "TRIGGER_KEY", "value" => "TRIGGER_VALUE", "public" => false}, - ] + ]) end end describe "PUT /builds/:id" do - let(:commit) { FactoryGirl.create(:commit, project: project)} - let(:build) { FactoryGirl.create(:build, commit: commit, runner_id: runner.id) } + let(:commit) { FactoryGirl.create(:ci_commit, project: project)} + let(:build) { FactoryGirl.create(:ci_build, commit: commit, runner_id: runner.id) } it "should update a running build" do build.run! put api("/builds/#{build.id}"), token: runner.token - response.status.should == 200 + expect(response.status).to eq(200) end it 'Should not override trace information when no trace is given' do diff --git a/spec/requests/ci/api/commits_spec.rb b/spec/requests/ci/api/commits_spec.rb index 99021dd681d..2ead68e2290 100644 --- a/spec/requests/ci/api/commits_spec.rb +++ b/spec/requests/ci/api/commits_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe Ci::API::API, 'Commits' do include ApiHelpers - let(:project) { FactoryGirl.create(:project) } - let(:commit) { FactoryGirl.create(:commit, project: project) } + let(:project) { FactoryGirl.create(:ci_project) } + let(:commit) { FactoryGirl.create(:ci_commit, project: project) } let(:options) { { @@ -19,10 +19,10 @@ describe Ci::API::API, 'Commits' do it "should return commits per project" do get api("/commits"), options - response.status.should == 200 - json_response.count.should == 1 - json_response.first["project_id"].should == project.id - json_response.first["sha"].should == commit.sha + expect(response.status).to eq(200) + expect(json_response.count).to eq(1) + expect(json_response.first["project_id"]).to eq(project.id) + expect(json_response.first["sha"]).to eq(commit.sha) end end @@ -51,15 +51,15 @@ describe Ci::API::API, 'Commits' do it "should create a build" do post api("/commits"), options.merge(data: data) - response.status.should == 201 - json_response['sha'].should == "da1560886d4f094c3e6c9ef40349f7d38b5d27d7" + expect(response.status).to eq(201) + expect(json_response['sha']).to eq("da1560886d4f094c3e6c9ef40349f7d38b5d27d7") end it "should return 400 error if no data passed" do post api("/commits"), options - response.status.should == 400 - json_response['message'].should == "400 (Bad request) \"data\" not given" + expect(response.status).to eq(400) + expect(json_response['message']).to eq("400 (Bad request) \"data\" not given") end end end diff --git a/spec/requests/ci/api/forks_spec.rb b/spec/requests/ci/api/forks_spec.rb index 74efc0c30be..27b9d045c8c 100644 --- a/spec/requests/ci/api/forks_spec.rb +++ b/spec/requests/ci/api/forks_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Ci::API::API do include ApiHelpers - let(:project) { FactoryGirl.create(:project) } + let(:project) { FactoryGirl.create(:ci_project) } let(:gitlab_url) { GitlabCi.config.gitlab_server.url } let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] } @@ -41,8 +41,8 @@ describe Ci::API::API do it "should create a project with valid data" do post api("/forks"), options - response.status.should == 201 - json_response['name'].should == "Gitlab.org / Underscore" + expect(response.status).to eq(201) + expect(json_response['name']).to eq("Gitlab.org / Underscore") end end @@ -53,7 +53,7 @@ describe Ci::API::API do it "should error with invalid data" do post api("/forks"), options - response.status.should == 400 + expect(response.status).to eq(400) end end end diff --git a/spec/requests/ci/api/projects_spec.rb b/spec/requests/ci/api/projects_spec.rb index 65cfc909b48..bca2c48c752 100644 --- a/spec/requests/ci/api/projects_spec.rb +++ b/spec/requests/ci/api/projects_spec.rb @@ -20,34 +20,34 @@ describe Ci::API::API do context "requests for scoped projects" do # NOTE: These ids are tied to the actual projects on demo.gitlab.com describe "GET /projects" do - let!(:project1) { FactoryGirl.create(:project, name: "gitlabhq", gitlab_id: 3) } - let!(:project2) { FactoryGirl.create(:project, name: "gitlab-ci", gitlab_id: 4) } + let!(:project1) { FactoryGirl.create(:ci_project, name: "gitlabhq", gitlab_id: 3) } + let!(:project2) { FactoryGirl.create(:ci_project, name: "gitlab-ci", gitlab_id: 4) } it "should return all projects on the CI instance" do get api("/projects"), options - response.status.should == 200 - json_response.count.should == 2 - json_response.first["id"].should == project1.id - json_response.last["id"].should == project2.id + expect(response.status).to eq(200) + expect(json_response.count).to eq(2) + expect(json_response.first["id"]).to eq(project1.id) + expect(json_response.last["id"]).to eq(project2.id) end end describe "GET /projects/owned" do # NOTE: This user doesn't own any of these projects on demo.gitlab.com - let!(:project1) { FactoryGirl.create(:project, name: "gitlabhq", gitlab_id: 3) } - let!(:project2) { FactoryGirl.create(:project, name: "random-project", gitlab_id: 9898) } + let!(:project1) { FactoryGirl.create(:ci_project, name: "gitlabhq", gitlab_id: 3) } + let!(:project2) { FactoryGirl.create(:ci_project, name: "random-project", gitlab_id: 9898) } it "should return all projects on the CI instance" do get api("/projects/owned"), options - response.status.should == 200 - json_response.count.should == 0 + expect(response.status).to eq(200) + expect(json_response.count).to eq(0) end end end describe "POST /projects/:project_id/webhooks" do - let!(:project) { FactoryGirl.create(:project) } + let!(:project) { FactoryGirl.create(:ci_project) } context "Valid Webhook URL" do let!(:webhook) { {web_hook: "http://example.com/sth/1/ala_ma_kota" } } @@ -58,19 +58,19 @@ describe Ci::API::API do it "should create webhook for specified project" do post api("/projects/#{project.id}/webhooks"), options - response.status.should == 201 - json_response["url"].should == webhook[:web_hook] + expect(response.status).to eq(201) + expect(json_response["url"]).to eq(webhook[:web_hook]) end it "fails to create webhook for non existsing project" do post api("/projects/non-existant-id/webhooks"), options - response.status.should == 404 + expect(response.status).to eq(404) end it "non-manager is not authorized" do - User.any_instance.stub(:can_manage_project?).and_return(false) + allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false) post api("/projects/#{project.id}/webhooks"), options - response.status.should == 401 + expect(response.status).to eq(401) end end @@ -83,39 +83,39 @@ describe Ci::API::API do it "fails to create webhook for not valid url" do post api("/projects/#{project.id}/webhooks"), options - response.status.should == 400 + expect(response.status).to eq(400) end end context "Missed web_hook parameter" do it "fails to create webhook for not provided url" do post api("/projects/#{project.id}/webhooks"), options - response.status.should == 400 + expect(response.status).to eq(400) end end end describe "GET /projects/:id" do - let!(:project) { FactoryGirl.create(:project) } + let!(:project) { FactoryGirl.create(:ci_project) } context "with an existing project" do it "should retrieve the project info" do get api("/projects/#{project.id}"), options - response.status.should == 200 - json_response['id'].should == project.id + expect(response.status).to eq(200) + expect(json_response['id']).to eq(project.id) end end context "with a non-existing project" do it "should return 404 error if project not found" do get api("/projects/non_existent_id"), options - response.status.should == 404 + expect(response.status).to eq(404) end end end describe "PUT /projects/:id" do - let!(:project) { FactoryGirl.create(:project) } + let!(:project) { FactoryGirl.create(:ci_project) } let!(:project_info) { {name: "An updated name!" } } before do @@ -124,41 +124,41 @@ describe Ci::API::API do it "should update a specific project's information" do put api("/projects/#{project.id}"), options - response.status.should == 200 - json_response["name"].should == project_info[:name] + expect(response.status).to eq(200) + expect(json_response["name"]).to eq(project_info[:name]) end it "fails to update a non-existing project" do put api("/projects/non-existant-id"), options - response.status.should == 404 + expect(response.status).to eq(404) end it "non-manager is not authorized" do - User.any_instance.stub(:can_manage_project?).and_return(false) + allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false) put api("/projects/#{project.id}"), options - response.status.should == 401 + expect(response.status).to eq(401) end end describe "DELETE /projects/:id" do - let!(:project) { FactoryGirl.create(:project) } + let!(:project) { FactoryGirl.create(:ci_project) } it "should delete a specific project" do delete api("/projects/#{project.id}"), options - response.status.should == 200 + expect(response.status).to eq(200) expect { project.reload }.to raise_error end it "non-manager is not authorized" do - User.any_instance.stub(:can_manage_project?).and_return(false) + allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false) delete api("/projects/#{project.id}"), options - response.status.should == 401 + expect(response.status).to eq(401) end it "is getting not found error" do delete api("/projects/not-existing_id"), options - response.status.should == 404 + expect(response.status).to eq(404) end end @@ -181,8 +181,8 @@ describe Ci::API::API do it "should create a project with valid data" do post api("/projects"), options - response.status.should == 201 - json_response['name'].should == project_info[:name] + expect(response.status).to eq(201) + expect(json_response['name']).to eq(project_info[:name]) end end @@ -193,58 +193,58 @@ describe Ci::API::API do it "should error with invalid data" do post api("/projects"), options - response.status.should == 400 + expect(response.status).to eq(400) end end describe "POST /projects/:id/runners/:id" do - let(:project) { FactoryGirl.create(:project) } - let(:runner) { FactoryGirl.create(:runner) } + let(:project) { FactoryGirl.create(:ci_project) } + let(:runner) { FactoryGirl.create(:ci_runner) } it "should add the project to the runner" do post api("/projects/#{project.id}/runners/#{runner.id}"), options - response.status.should == 201 + expect(response.status).to eq(201) project.reload - project.runners.first.id.should == runner.id + expect(project.runners.first.id).to eq(runner.id) end it "should fail if it tries to link a non-existing project or runner" do post api("/projects/#{project.id}/runners/non-existing"), options - response.status.should == 404 + expect(response.status).to eq(404) post api("/projects/non-existing/runners/#{runner.id}"), options - response.status.should == 404 + expect(response.status).to eq(404) end it "non-manager is not authorized" do - User.any_instance.stub(:can_manage_project?).and_return(false) + allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false) post api("/projects/#{project.id}/runners/#{runner.id}"), options - response.status.should == 401 + expect(response.status).to eq(401) end end describe "DELETE /projects/:id/runners/:id" do - let(:project) { FactoryGirl.create(:project) } - let(:runner) { FactoryGirl.create(:runner) } + let(:project) { FactoryGirl.create(:ci_project) } + let(:runner) { FactoryGirl.create(:ci_runner) } before do post api("/projects/#{project.id}/runners/#{runner.id}"), options end it "should remove the project from the runner" do - project.runners.should be_present + expect(project.runners).to be_present delete api("/projects/#{project.id}/runners/#{runner.id}"), options - response.status.should == 200 + expect(response.status).to eq(200) project.reload - project.runners.should be_empty + expect(project.runners).to be_empty end it "non-manager is not authorized" do - User.any_instance.stub(:can_manage_project?).and_return(false) + allow_any_instance_of(User).to receive(:can_manage_project?).and_return(false) post api("/projects/#{project.id}/runners/#{runner.id}"), options - response.status.should == 401 + expect(response.status).to eq(401) end end end diff --git a/spec/requests/ci/api/runners_spec.rb b/spec/requests/ci/api/runners_spec.rb index 3faebd40bae..61ea3be870d 100644 --- a/spec/requests/ci/api/runners_spec.rb +++ b/spec/requests/ci/api/runners_spec.rb @@ -19,15 +19,15 @@ describe Ci::API::API do } before do - 5.times { FactoryGirl.create(:runner) } + 5.times { FactoryGirl.create(:ci_runner) } end it "should retrieve a list of all runners" do get api("/runners"), options - response.status.should == 200 - json_response.count.should == 5 - json_response.last.should have_key("id") - json_response.last.should have_key("token") + expect(response.status).to eq(200) + expect(json_response.count).to eq(5) + expect(json_response.last).to have_key("id") + expect(json_response.last).to have_key("token") end end @@ -35,49 +35,49 @@ describe Ci::API::API do describe "should create a runner if token provided" do before { post api("/runners/register"), token: GitlabCi::REGISTRATION_TOKEN } - it { response.status.should == 201 } + it { expect(response.status).to eq(201) } end describe "should create a runner with description" do before { post api("/runners/register"), token: GitlabCi::REGISTRATION_TOKEN, description: "server.hostname" } - it { response.status.should == 201 } - it { Runner.first.description.should == "server.hostname" } + it { expect(response.status).to eq(201) } + it { expect(Runner.first.description).to eq("server.hostname") } end describe "should create a runner with tags" do before { post api("/runners/register"), token: GitlabCi::REGISTRATION_TOKEN, tag_list: "tag1, tag2" } - it { response.status.should == 201 } - it { Runner.first.tag_list.sort.should == ["tag1", "tag2"] } + it { expect(response.status).to eq(201) } + it { expect(Runner.first.tag_list.sort).to eq(["tag1", "tag2"]) } end describe "should create a runner if project token provided" do - let(:project) { FactoryGirl.create(:project) } + let(:project) { FactoryGirl.create(:ci_project) } before { post api("/runners/register"), token: project.token } - it { response.status.should == 201 } - it { project.runners.size.should == 1 } + it { expect(response.status).to eq(201) } + it { expect(project.runners.size).to eq(1) } end it "should return 403 error if token is invalid" do post api("/runners/register"), token: 'invalid' - response.status.should == 403 + expect(response.status).to eq(403) end it "should return 400 error if no token" do post api("/runners/register") - response.status.should == 400 + expect(response.status).to eq(400) end end describe "DELETE /runners/delete" do - let!(:runner) { FactoryGirl.create(:runner) } + let!(:runner) { FactoryGirl.create(:ci_runner) } before { delete api("/runners/delete"), token: runner.token } - it { response.status.should == 200 } - it { Runner.count.should == 0 } + it { expect(response.status).to eq(200) } + it { expect(Runner.count).to eq(0) } end end diff --git a/spec/requests/ci/api/triggers_spec.rb b/spec/requests/ci/api/triggers_spec.rb index 5da40a69991..56757c8f8c7 100644 --- a/spec/requests/ci/api/triggers_spec.rb +++ b/spec/requests/ci/api/triggers_spec.rb @@ -5,9 +5,9 @@ describe Ci::API::API do describe 'POST /projects/:project_id/refs/:ref/trigger' do let!(:trigger_token) { 'secure token' } - let!(:project) { FactoryGirl.create(:project) } - let!(:project2) { FactoryGirl.create(:project) } - let!(:trigger) { FactoryGirl.create(:trigger, project: project, token: trigger_token) } + 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) { { token: trigger_token @@ -17,36 +17,36 @@ describe Ci::API::API do context 'Handles errors' do it 'should return bad request if token is missing' do post api("/projects/#{project.id}/refs/master/trigger") - response.status.should == 400 + expect(response.status).to eq(400) end it 'should return not found if project is not found' do post api('/projects/0/refs/master/trigger'), options - response.status.should == 404 + expect(response.status).to eq(404) end it 'should return unauthorized if token is for different project' do post api("/projects/#{project2.id}/refs/master/trigger"), options - response.status.should == 401 + expect(response.status).to eq(401) end end context 'Have a commit' do before do - @commit = FactoryGirl.create(:commit, project: project) + @commit = FactoryGirl.create(:ci_commit, project: project) end it 'should create builds' do post api("/projects/#{project.id}/refs/master/trigger"), options - response.status.should == 201 + expect(response.status).to eq(201) @commit.builds.reload - @commit.builds.size.should == 2 + expect(@commit.builds.size).to eq(2) end it 'should return bad request with no builds created if there\'s no commit for that ref' do post api("/projects/#{project.id}/refs/other-branch/trigger"), options - response.status.should == 400 - json_response['message'].should == 'No builds created' + expect(response.status).to eq(400) + expect(json_response['message']).to eq('No builds created') end context 'Validates variables' do @@ -56,21 +56,21 @@ describe Ci::API::API do it 'should validate variables to be a hash' do post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: 'value') - response.status.should == 400 - json_response['message'].should == 'variables needs to be a hash' + expect(response.status).to eq(400) + expect(json_response['message']).to eq('variables needs to be a hash') end it 'should validate variables needs to be a map of key-valued strings' do post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: {key: %w(1 2)}) - response.status.should == 400 - json_response['message'].should == 'variables needs to be a map of key-valued strings' + expect(response.status).to eq(400) + expect(json_response['message']).to eq('variables needs to be a map of key-valued strings') end it 'create trigger request with variables' do post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: variables) - response.status.should == 201 + expect(response.status).to eq(201) @commit.builds.reload - @commit.builds.first.trigger_request.variables.should == variables + expect(@commit.builds.first.trigger_request.variables).to eq(variables) end end end diff --git a/spec/requests/ci/builds_spec.rb b/spec/requests/ci/builds_spec.rb index 73d540e372a..0d7650ef582 100644 --- a/spec/requests/ci/builds_spec.rb +++ b/spec/requests/ci/builds_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' describe "Builds" do before do - @project = FactoryGirl.create :project - @commit = FactoryGirl.create :commit, project: @project - @build = FactoryGirl.create :build, commit: @commit + @project = FactoryGirl.create :ci_project + @commit = FactoryGirl.create :ci_commit, project: @project + @build = FactoryGirl.create :ci_build, commit: @commit end describe "GET /:project/builds/:id/status.json" do @@ -12,7 +12,7 @@ describe "Builds" do get status_project_build_path(@project, @build), format: :json end - it { response.status.should == 200 } - it { response.body.should include(@build.sha) } + it { expect(response.status).to eq(200) } + it { expect(response.body).to include(@build.sha) } end end diff --git a/spec/requests/ci/commits_spec.rb b/spec/requests/ci/commits_spec.rb index e9d8366c41a..fe7bd2de3e7 100644 --- a/spec/requests/ci/commits_spec.rb +++ b/spec/requests/ci/commits_spec.rb @@ -2,8 +2,8 @@ require 'spec_helper' describe "Commits" do before do - @project = FactoryGirl.create :project - @commit = FactoryGirl.create :commit, project: @project + @project = FactoryGirl.create :ci_project + @commit = FactoryGirl.create :ci_commit, project: @project end describe "GET /:project/refs/:ref_name/commits/:id/status.json" do @@ -11,7 +11,7 @@ describe "Commits" do get status_project_ref_commit_path(@project, @commit.ref, @commit.sha), format: :json end - it { response.status.should == 200 } - it { response.body.should include(@commit.sha) } + it { expect(response.status).to eq(200) } + it { expect(response.body).to include(@commit.sha) } end end |