use Time.zone as much as possible

did committed Mar 26, 2015
commit 48965c9f2318a48ddaac777b7de7cea6f2155b43
Showing 4 changed files with 6 additions and 6 deletions
locomotive/steam/entities/content_entry.rb b/lib/locomotive/steam/entities/content_entry.rb +2 -2
@@ @@ -12,8 +12,8 @@ module Locomotive::Steam
super({
_visible: true,
_position: 0,
- created_at: Time.now,
- updated_at: Time.now
+ created_at: Time.zone.now,
+ updated_at: Time.zone.now
}.merge(attributes))
end
locomotive/steam/entities/page.rb b/lib/locomotive/steam/entities/page.rb +1 -1
@@ @@ -23,7 +23,7 @@ module Locomotive::Steam
redirect_type: nil,
parent_id: nil,
parent_ids: nil,
- updated_at: Time.now
+ updated_at: Time.zone.now
}.merge(attributes))
end
spec/integration/server/sitemap_spec.rb +2 -2
@@ @@ -12,7 +12,7 @@ describe Locomotive::Steam::Server do
subject { get '/sitemap.xml'; last_response.body }
- before { allow(Time).to receive(:now).and_return(Time.zone.parse('2015/03/25 10:00:00')); }
+ before { allow(Time).to receive(:now).and_return(Time.zone.parse('2015/03/25 10:00:00')) }
it 'checks if it looks valid' do
expect(Nokogiri::XML(subject).errors.empty?).to eq true
@@ @@ -21,7 +21,7 @@ describe Locomotive::Steam::Server do
expect(subject).to match((<<-EOF
<url>
<loc>http://example.org/fr/a-notre-sujet</loc>
- <lastmod>2015-03-25</lastmod>
+ <lastmod>2015-03-26</lastmod>
<priority>0.9</priority>
</url>
EOF
spec/unit/adapters/memory/order_spec.rb +1 -1
@@ @@ -41,7 +41,7 @@ describe Locomotive::Steam::Adapters::Memory::Order do
subject { order.apply_to(entry, :en) }
let(:input) { 'title asc, date desc' }
- let(:entry) { instance_double('Entry', title: 'foo', date: Time.now) }
+ let(:entry) { instance_double('Entry', title: 'foo', date: Time.zone.now) }
it { expect(subject.map(&:class)).to eq([Locomotive::Steam::Adapters::Memory::Order::Asc, Locomotive::Steam::Adapters::Memory::Order::Desc]) }
end