diff options
author | Xavier Noria <fxn@hashref.com> | 2016-08-06 18:54:50 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-08-06 18:54:50 +0200 |
commit | 35b3de8021e68649cac963bd82a74cc75d1f60f0 (patch) | |
tree | d37f9096be6ee54a13d3c04cc8e1c5a9ba0d99ec /actionpack/test/controller/api | |
parent | 628e51ff109334223094e30ad1365188bbd7f9c6 (diff) | |
download | rails-35b3de8021e68649cac963bd82a74cc75d1f60f0.tar.gz rails-35b3de8021e68649cac963bd82a74cc75d1f60f0.tar.bz2 rails-35b3de8021e68649cac963bd82a74cc75d1f60f0.zip |
applies new string literal convention in actionpack/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
Diffstat (limited to 'actionpack/test/controller/api')
9 files changed, 30 insertions, 30 deletions
diff --git a/actionpack/test/controller/api/conditional_get_test.rb b/actionpack/test/controller/api/conditional_get_test.rb index b4f1673be0..330bfac1c9 100644 --- a/actionpack/test/controller/api/conditional_get_test.rb +++ b/actionpack/test/controller/api/conditional_get_test.rb @@ -1,6 +1,6 @@ -require 'abstract_unit' -require 'active_support/core_ext/integer/time' -require 'active_support/core_ext/numeric/time' +require "abstract_unit" +require "active_support/core_ext/integer/time" +require "active_support/core_ext/numeric/time" class ConditionalGetApiController < ActionController::API before_action :handle_last_modified_and_etags, only: :two @@ -31,7 +31,7 @@ class ConditionalGetApiTest < ActionController::TestCase def test_request_gets_last_modified get :two - assert_equal @last_modified, @response.headers['Last-Modified'] + assert_equal @last_modified, @response.headers["Last-Modified"] assert_response :success end @@ -52,6 +52,6 @@ class ConditionalGetApiTest < ActionController::TestCase get :one assert_equal 304, @response.status.to_i assert @response.body.blank? - assert_equal @last_modified, @response.headers['Last-Modified'] + assert_equal @last_modified, @response.headers["Last-Modified"] end end diff --git a/actionpack/test/controller/api/data_streaming_test.rb b/actionpack/test/controller/api/data_streaming_test.rb index 0e7d97d1f4..f15b78d102 100644 --- a/actionpack/test/controller/api/data_streaming_test.rb +++ b/actionpack/test/controller/api/data_streaming_test.rb @@ -1,8 +1,8 @@ -require 'abstract_unit' +require "abstract_unit" module TestApiFileUtils def file_path() File.expand_path(__FILE__) end - def file_data() @data ||= File.open(file_path, 'rb') { |f| f.read } end + def file_data() @data ||= File.open(file_path, "rb") { |f| f.read } end end class DataStreamingApiController < ActionController::API @@ -19,7 +19,7 @@ class DataStreamingApiTest < ActionController::TestCase tests DataStreamingApiController def test_data - response = process('two') + response = process("two") assert_kind_of String, response.body assert_equal file_data, response.body end diff --git a/actionpack/test/controller/api/force_ssl_test.rb b/actionpack/test/controller/api/force_ssl_test.rb index 8578340d82..d239964e4a 100644 --- a/actionpack/test/controller/api/force_ssl_test.rb +++ b/actionpack/test/controller/api/force_ssl_test.rb @@ -1,4 +1,4 @@ -require 'abstract_unit' +require "abstract_unit" class ForceSSLApiController < ActionController::API force_ssl diff --git a/actionpack/test/controller/api/implicit_render_test.rb b/actionpack/test/controller/api/implicit_render_test.rb index 26f9cd8f78..b51ee0cf42 100644 --- a/actionpack/test/controller/api/implicit_render_test.rb +++ b/actionpack/test/controller/api/implicit_render_test.rb @@ -1,4 +1,4 @@ -require 'abstract_unit' +require "abstract_unit" class ImplicitRenderAPITestController < ActionController::API def empty_action diff --git a/actionpack/test/controller/api/params_wrapper_test.rb b/actionpack/test/controller/api/params_wrapper_test.rb index 53b3a0c3cc..cdf5acecae 100644 --- a/actionpack/test/controller/api/params_wrapper_test.rb +++ b/actionpack/test/controller/api/params_wrapper_test.rb @@ -1,4 +1,4 @@ -require 'abstract_unit' +require "abstract_unit" class ParamsWrapperForApiTest < ActionController::TestCase class UsersController < ActionController::API @@ -17,10 +17,10 @@ class ParamsWrapperForApiTest < ActionController::TestCase tests UsersController def test_specify_wrapper_name - @request.env['CONTENT_TYPE'] = 'application/json' - post :test, params: { 'username' => 'sikachu' } + @request.env["CONTENT_TYPE"] = "application/json" + post :test, params: { "username" => "sikachu" } - expected = { 'username' => 'sikachu', 'person' => { 'username' => 'sikachu' }} + expected = { "username" => "sikachu", "person" => { "username" => "sikachu" }} assert_equal expected, @controller.last_parameters end end diff --git a/actionpack/test/controller/api/redirect_to_test.rb b/actionpack/test/controller/api/redirect_to_test.rb index 18877c4b3a..ab14409f40 100644 --- a/actionpack/test/controller/api/redirect_to_test.rb +++ b/actionpack/test/controller/api/redirect_to_test.rb @@ -1,4 +1,4 @@ -require 'abstract_unit' +require "abstract_unit" class RedirectToApiController < ActionController::API def one diff --git a/actionpack/test/controller/api/renderers_test.rb b/actionpack/test/controller/api/renderers_test.rb index 911a8144b2..7eecc1c680 100644 --- a/actionpack/test/controller/api/renderers_test.rb +++ b/actionpack/test/controller/api/renderers_test.rb @@ -1,14 +1,14 @@ -require 'abstract_unit' -require 'active_support/core_ext/hash/conversions' +require "abstract_unit" +require "active_support/core_ext/hash/conversions" class RenderersApiController < ActionController::API class Model def to_json(options = {}) - { a: 'b' }.to_json(options) + { a: "b" }.to_json(options) end def to_xml(options = {}) - { a: 'b' }.to_xml(options) + { a: "b" }.to_xml(options) end end @@ -21,11 +21,11 @@ class RenderersApiController < ActionController::API end def plain - render plain: 'Hi from plain', status: 500 + render plain: "Hi from plain", status: 500 end def text - render text: 'Hi from text', status: 500 + render text: "Hi from text", status: 500 end end @@ -35,19 +35,19 @@ class RenderersApiTest < ActionController::TestCase def test_render_json get :one assert_response :success - assert_equal({ a: 'b' }.to_json, @response.body) + assert_equal({ a: "b" }.to_json, @response.body) end def test_render_xml get :two assert_response :success - assert_equal({ a: 'b' }.to_xml, @response.body) + assert_equal({ a: "b" }.to_xml, @response.body) end def test_render_plain get :plain assert_response :internal_server_error - assert_equal('Hi from plain', @response.body) + assert_equal("Hi from plain", @response.body) end def test_render_text @@ -55,6 +55,6 @@ class RenderersApiTest < ActionController::TestCase get :text end assert_response :internal_server_error - assert_equal('Hi from text', @response.body) + assert_equal("Hi from text", @response.body) end end diff --git a/actionpack/test/controller/api/url_for_test.rb b/actionpack/test/controller/api/url_for_test.rb index 0d8691a091..cb4ae7a88a 100644 --- a/actionpack/test/controller/api/url_for_test.rb +++ b/actionpack/test/controller/api/url_for_test.rb @@ -1,4 +1,4 @@ -require 'abstract_unit' +require "abstract_unit" class UrlForApiController < ActionController::API def one; end @@ -10,7 +10,7 @@ class UrlForApiTest < ActionController::TestCase def setup super - @request.host = 'www.example.com' + @request.host = "www.example.com" end def test_url_for diff --git a/actionpack/test/controller/api/with_cookies_test.rb b/actionpack/test/controller/api/with_cookies_test.rb index 4491dc9002..8928237dfd 100644 --- a/actionpack/test/controller/api/with_cookies_test.rb +++ b/actionpack/test/controller/api/with_cookies_test.rb @@ -1,4 +1,4 @@ -require 'abstract_unit' +require "abstract_unit" class WithCookiesController < ActionController::API include ActionController::Cookies @@ -12,10 +12,10 @@ class WithCookiesTest < ActionController::TestCase tests WithCookiesController def test_with_cookies - request.cookies[:foobar] = 'bazbang' + request.cookies[:foobar] = "bazbang" get :with_cookies - assert_equal 'bazbang', response.body + assert_equal "bazbang", response.body end end |