1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use nex hash syntax on tests

This commit is contained in:
Santiago Pastorino 2015-04-21 16:15:45 -04:00
parent 3d3730040d
commit 4c1b437ed7

View file

@ -3,22 +3,22 @@ require 'active_support/core_ext/integer/time'
require 'active_support/core_ext/numeric/time' require 'active_support/core_ext/numeric/time'
class ConditionalGetApiController < ActionController::API class ConditionalGetApiController < ActionController::API
before_action :handle_last_modified_and_etags, :only => :two before_action :handle_last_modified_and_etags, only: :two
def one def one
if stale?(:last_modified => Time.now.utc.beginning_of_day, :etag => [:foo, 123]) if stale?(last_modified: Time.now.utc.beginning_of_day, etag: [:foo, 123])
render :text => "Hi!" render text: "Hi!"
end end
end end
def two def two
render :text => "Hi!" render text: "Hi!"
end end
private private
def handle_last_modified_and_etags def handle_last_modified_and_etags
fresh_when(:last_modified => Time.now.utc.beginning_of_day, :etag => [ :foo, 123 ]) fresh_when(last_modified: Time.now.utc.beginning_of_day, etag: [ :foo, 123 ])
end end
end end