Permalink
Browse files

fix to APN::App tests

  • Loading branch information...
PRXci committed Nov 9, 2010
1 parent 14897be commit fec9599ed1bc60d3c3340371e5efc94b158c1e4f
Showing with 5 additions and 0 deletions.
  1. +5 −0 spec/apn_on_rails/app/models/apn/app_spec.rb
@@ -166,6 +166,10 @@
devices = [DeviceFactory.create(:app_id => app.id, :last_registered_at => 1.week.ago, :feedback_at => Time.now),
DeviceFactory.create(:app_id => app.id, :last_registered_at => 1.week.from_now, :feedback_at => Time.now)]
puts "device ids are #{devices[0].id} and #{devices[1].id}"
+ devices[0].last_registered_at = 1.week.ago
+ devices[0].save
+ devices[1].last_registered_at = 1.week.from_now
+ devices[1].save
APN::Feedback.should_receive(:devices).twice.and_return(devices)
APN::App.should_receive(:all).and_return([app])
app.should_receive(:cert).twice.and_return(app.apn_dev_cert)
@@ -181,6 +185,7 @@
it 'should destroy devices that have a last_registered_at date that is before the feedback_at date that have no app' do
device = DeviceFactory.create(:app_id => nil, :last_registered_at => 1.week.ago, :feedback_at => Time.now)
device.app_id = nil
+ device.last_registered_at = 1.week.ago
device.save
APN::Feedback.should_receive(:devices).and_return([device])
APN::App.should_receive(:all).and_return([])

0 comments on commit fec9599

Please sign in to comment.