diff --git a/lib/travis/api/v3/services/lint/lint.rb b/lib/travis/api/v3/services/lint/lint.rb index e3e5cf2f..3ee9f665 100644 --- a/lib/travis/api/v3/services/lint/lint.rb +++ b/lib/travis/api/v3/services/lint/lint.rb @@ -2,11 +2,11 @@ require 'travis/yaml' module Travis::API::V3 class Services::Lint::Lint < Service - params "content" + params 'content' def run! request_body.rewind - content = params[:content] || request_body.read - parsed = Travis::Yaml.parse(content) + content = params['content'.freeze] || request_body.read + Travis::Yaml.parse(content) end end end diff --git a/spec/v3/services/lint/lint_spec.rb b/spec/v3/services/lint/lint_spec.rb index e111f33a..affa8f14 100644 --- a/spec/v3/services/lint/lint_spec.rb +++ b/spec/v3/services/lint/lint_spec.rb @@ -3,15 +3,13 @@ require 'spec_helper' describe Travis::API::V3::Services::Lint::Lint do let(:content) { "foo: bar" } let(:parsed_body) { JSON.load(last_response.body) } + let(:headers) {{ 'CONTENT_TYPE' => 'text/yaml'}} + describe "accepts content in parameter" do before { post("v3/lint", content: content ) } example { expect(last_response).to be_ok } example { expect(parsed_body).to be == { - "@warnings" => [{ - "@type" => "warning", - "message" => "query parameter foo: bar not whitelisted, ignored", - "warning_type" => "ignored_parameter", "parameter"=>"foo: bar"}], "@type" => "lint", "warnings" => [{ "key" => [], @@ -22,13 +20,9 @@ describe Travis::API::V3::Services::Lint::Lint do end describe "accepts content as body" do - before { post("/v3/lint", content) } + before { post("/v3/lint", content, headers) } example { expect(last_response).to be_ok } example { expect(parsed_body).to be == { - "@warnings" => [{ - "@type" => "warning", - "message" => "query parameter foo: bar not whitelisted, ignored", - "warning_type" => "ignored_parameter", "parameter"=>"foo: bar"}], "@type" => "lint", "warnings" => [{ "key" => [],