Convert to Ruby 1.9 hash syntax

This commit is contained in:
Erik Michaels-Ober 2013-12-02 12:37:18 +01:00
parent 98e978a03b
commit 9fcd1cb5f8
3 changed files with 5 additions and 5 deletions

View File

@ -4,7 +4,7 @@ class SessionsController < Devise::SessionsController
end end
def create def create
resource = warden.authenticate(:scope => resource_name) resource = warden.authenticate(scope: resource_name)
if resource if resource
sign_in(resource_name, resource) sign_in(resource_name, resource)
render(json: resource) render(json: resource)

View File

@ -3,7 +3,7 @@ require 'test_helper'
class AddressesControllerTest < ActionController::TestCase class AddressesControllerTest < ActionController::TestCase
test 'should return latitude and longitude for a valid address' do test 'should return latitude and longitude for a valid address' do
stub_request(:get, "http://maps.google.com/maps/geo"). stub_request(:get, "http://maps.google.com/maps/geo").
with(:query => {:key => "REPLACE_WITH_YOUR_GOOGLE_KEY", :oe => "utf-8", :output => "xml", :q => "City Hall, Boston, MA"}). with(query: {key: "REPLACE_WITH_YOUR_GOOGLE_KEY", oe: "utf-8", output: "xml", q: "City Hall, Boston, MA"}).
to_return(body: File.read(File.expand_path('../../fixtures/city_hall.kml', __FILE__))) to_return(body: File.read(File.expand_path('../../fixtures/city_hall.kml', __FILE__)))
get :show, address: 'City Hall', city_state: "Boston, MA" get :show, address: 'City Hall', city_state: "Boston, MA"
assert_not_nil assigns :address assert_not_nil assigns :address
@ -11,10 +11,10 @@ class AddressesControllerTest < ActionController::TestCase
test 'should return an error for an invalid address' do test 'should return an error for an invalid address' do
stub_request(:get, "http://geocoder.us/service/csv/geocode"). stub_request(:get, "http://geocoder.us/service/csv/geocode").
with(:query => {:address => ", "}). with(query: {address: ", "}).
to_return(body: File.read(File.expand_path('../../fixtures/unknown_address.txt', __FILE__))) to_return(body: File.read(File.expand_path('../../fixtures/unknown_address.txt', __FILE__)))
stub_request(:get, "http://maps.google.com/maps/geo"). stub_request(:get, "http://maps.google.com/maps/geo").
with(:query => {:key => "REPLACE_WITH_YOUR_GOOGLE_KEY", :oe => "utf-8", :output => "xml", :q => ", "}). with(query: {key: "REPLACE_WITH_YOUR_GOOGLE_KEY", oe: "utf-8", output: "xml", q: ", "}).
to_return(body: File.read(File.expand_path('../../fixtures/unknown_address.kml', __FILE__))) to_return(body: File.read(File.expand_path('../../fixtures/unknown_address.kml', __FILE__)))
get :show, address: '', city_state: '' get :show, address: '', city_state: ''
assert_response :missing assert_response :missing

View File

@ -10,7 +10,7 @@ class RemindersControllerTest < ActionController::TestCase
@thing.user = @dan @thing.user = @dan
@thing.save! @thing.save!
stub_request(:get, "http://maps.google.com/maps/geo"). stub_request(:get, "http://maps.google.com/maps/geo").
with(:query => {:key => "REPLACE_WITH_YOUR_GOOGLE_KEY", :ll => "42.383339,-71.049226", :oe => "utf-8", :output => "xml"}). with(query: {key: "REPLACE_WITH_YOUR_GOOGLE_KEY", ll: "42.383339,-71.049226", oe: "utf-8", output: "xml"}).
to_return(body: File.read(File.expand_path('../../fixtures/geo.kml', __FILE__))) to_return(body: File.read(File.expand_path('../../fixtures/geo.kml', __FILE__)))
end end