Skip to content

Commit

Permalink
using Time instead DateTime class
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigora committed Jun 26, 2015
1 parent 084bd5e commit d08e21c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/action_controller/serialization_test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

require 'test_helper'

module ActionController
Expand Down Expand Up @@ -48,7 +49,7 @@ def render_object_with_cache_enabled
end

def update_and_render_object_with_cache_enabled
@post.updated_at = DateTime.now
@post.updated_at = Time.now

generate_cached_serializer(@post)
render json: @post
Expand Down Expand Up @@ -105,7 +106,7 @@ def render_fragment_changed_object_with_relationship

generate_cached_serializer(like)
like.post = post2
like.time = DateTime.now.to_s
like.time = Time.now.to_s

render json: like
end
Expand Down Expand Up @@ -223,7 +224,7 @@ def test_render_with_cache_enable
}

ActionController::Base.cache_store.clear
Timecop.freeze(DateTime.now) do
Timecop.freeze(Time.now) do
get :render_object_with_cache_enabled

assert_equal 'application/json', @response.content_type
Expand Down Expand Up @@ -288,13 +289,13 @@ def test_render_with_fragment_except_cache_enable
def test_render_fragment_changed_object_with_relationship
ActionController::Base.cache_store.clear

Timecop.freeze(DateTime.now) do
Timecop.freeze(Time.now) do
get :render_fragment_changed_object_with_relationship
response = JSON.parse(@response.body)

expected_return = {
"id"=>1,
"time"=>DateTime.now.to_s,
"time"=>Time.now.to_s,
"post" => {
"id"=>1,
"title"=>"New Post",
Expand Down

0 comments on commit d08e21c

Please sign in to comment.