diff options
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/ci/api/builds_spec.rb | 20 | ||||
-rw-r--r-- | spec/requests/ci/api/commits_spec.rb | 8 | ||||
-rw-r--r-- | spec/requests/ci/api/forks_spec.rb | 12 | ||||
-rw-r--r-- | spec/requests/ci/api/projects_spec.rb | 16 | ||||
-rw-r--r-- | spec/requests/ci/api/runners_spec.rb | 12 | ||||
-rw-r--r-- | spec/requests/ci/api/triggers_spec.rb | 8 |
6 files changed, 38 insertions, 38 deletions
diff --git a/spec/requests/ci/api/builds_spec.rb b/spec/requests/ci/api/builds_spec.rb index c416ca98e1f..61f9d940c3b 100644 --- a/spec/requests/ci/api/builds_spec.rb +++ b/spec/requests/ci/api/builds_spec.rb @@ -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 api("/builds/register"), token: runner.token, info: { platform: :darwin } expect(response.status).to eq(201) expect(json_response['sha']).to eq(build.sha) @@ -55,10 +55,10 @@ 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 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"]}) + expect(json_response["options"]).to eq({ "image" => "ruby:2.1", "services" => ["postgres"] }) end it "returns variables" do @@ -66,12 +66,12 @@ describe Ci::API::API do commit.create_builds project.variables << Variable.new(key: "SECRET_KEY", value: "secret_value") - post api("/builds/register"), token: runner.token, info: {platform: :darwin} + post api("/builds/register"), token: runner.token, info: { platform: :darwin } 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" => "DB_NAME", "value" => "postgres", "public" => true }, + { "key" => "SECRET_KEY", "value" => "secret_value", "public" => false }, ]) end @@ -83,13 +83,13 @@ describe Ci::API::API do 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} + post api("/builds/register"), token: runner.token, info: { platform: :darwin } 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}, + { "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 diff --git a/spec/requests/ci/api/commits_spec.rb b/spec/requests/ci/api/commits_spec.rb index 2ead68e2290..a4c2a507e88 100644 --- a/spec/requests/ci/api/commits_spec.rb +++ b/spec/requests/ci/api/commits_spec.rb @@ -6,12 +6,12 @@ describe Ci::API::API, 'Commits' do let(:project) { FactoryGirl.create(:ci_project) } let(:commit) { FactoryGirl.create(:ci_commit, project: project) } - let(:options) { + let(:options) do { project_token: project.token, project_id: project.id } - } + end describe "GET /commits" do before { commit } @@ -27,7 +27,7 @@ describe Ci::API::API, 'Commits' do end describe "POST /commits" do - let(:data) { + let(:data) do { "before" => "95790bf891e76fee5e1747ab589903a6a1f80f22", "after" => "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", @@ -46,7 +46,7 @@ describe Ci::API::API, 'Commits' do ], ci_yaml_file: gitlab_ci_yaml } - } + end it "should create a build" do post api("/commits"), options.merge(data: data) diff --git a/spec/requests/ci/api/forks_spec.rb b/spec/requests/ci/api/forks_spec.rb index 27b9d045c8c..6f5dc0bc1d9 100644 --- a/spec/requests/ci/api/forks_spec.rb +++ b/spec/requests/ci/api/forks_spec.rb @@ -7,20 +7,20 @@ describe Ci::API::API do let(:gitlab_url) { GitlabCi.config.gitlab_server.url } let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] } - let(:options) { + let(:options) do { private_token: private_token, url: gitlab_url } - } + end - before { + before do stub_gitlab_calls - } + end describe "POST /forks" do - let(:project_info) { + let(:project_info) do { project_id: project.gitlab_id, project_token: project.token, @@ -32,7 +32,7 @@ describe Ci::API::API do ssh_url_to_repo: "git@example.com:gitlab-org/underscore" } } - } + end context "with valid info" do before do diff --git a/spec/requests/ci/api/projects_spec.rb b/spec/requests/ci/api/projects_spec.rb index bca2c48c752..05f6bd5f4f3 100644 --- a/spec/requests/ci/api/projects_spec.rb +++ b/spec/requests/ci/api/projects_spec.rb @@ -6,16 +6,16 @@ describe Ci::API::API do let(:gitlab_url) { GitlabCi.config.gitlab_server.url } let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] } - let(:options) { + let(:options) do { private_token: private_token, url: gitlab_url } - } + end - before { + before do stub_gitlab_calls - } + end context "requests for scoped projects" do # NOTE: These ids are tied to the actual projects on demo.gitlab.com @@ -75,7 +75,7 @@ describe Ci::API::API do end context "Invalid Webhook URL" do - let!(:webhook) { {web_hook: "ala_ma_kota" } } + let!(:webhook) { { web_hook: "ala_ma_kota" } } before do options.merge!(webhook) @@ -116,7 +116,7 @@ describe Ci::API::API do describe "PUT /projects/:id" do let!(:project) { FactoryGirl.create(:ci_project) } - let!(:project_info) { {name: "An updated name!" } } + let!(:project_info) { { name: "An updated name!" } } before do options.merge!(project_info) @@ -163,14 +163,14 @@ describe Ci::API::API do end describe "POST /projects" do - let(:project_info) { + let(:project_info) do { name: "My project", gitlab_id: 1, path: "testing/testing", ssh_url_to_repo: "ssh://example.com/testing/testing.git" } - } + end let(:invalid_project_info) { {} } diff --git a/spec/requests/ci/api/runners_spec.rb b/spec/requests/ci/api/runners_spec.rb index 61ea3be870d..714e5a5a84f 100644 --- a/spec/requests/ci/api/runners_spec.rb +++ b/spec/requests/ci/api/runners_spec.rb @@ -4,19 +4,19 @@ describe Ci::API::API do include ApiHelpers include StubGitlabCalls - before { + before do stub_gitlab_calls - } + end describe "GET /runners" do let(:gitlab_url) { GitlabCi.config.gitlab_server.url } let(:private_token) { Network.new.authenticate(access_token: "some_token")["private_token"] } - let(:options) { + let(:options) do { - :private_token => private_token, - :url => gitlab_url + private_token: private_token, + url: gitlab_url } - } + end before do 5.times { FactoryGirl.create(:ci_runner) } diff --git a/spec/requests/ci/api/triggers_spec.rb b/spec/requests/ci/api/triggers_spec.rb index 56757c8f8c7..56799b5203a 100644 --- a/spec/requests/ci/api/triggers_spec.rb +++ b/spec/requests/ci/api/triggers_spec.rb @@ -50,9 +50,9 @@ describe Ci::API::API do end context 'Validates variables' do - let(:variables) { - {'TRIGGER_KEY' => 'TRIGGER_VALUE'} - } + let(:variables) do + { 'TRIGGER_KEY' => 'TRIGGER_VALUE' } + end it 'should validate variables to be a hash' do post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: 'value') @@ -61,7 +61,7 @@ describe Ci::API::API do 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)}) + post api("/projects/#{project.id}/refs/master/trigger"), options.merge(variables: { key: %w(1 2) }) expect(response.status).to eq(400) expect(json_response['message']).to eq('variables needs to be a map of key-valued strings') end |