Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. require 'spec_helper'
  2.  
  3. describe Manager::Synchronization do
  4.  
  5. it "contains all parameters" do
  6. build_stubbed(:synchronization, elapsed_time: nil).should_not be_valid
  7. build_stubbed(:synchronization, updated_records: nil).should_not be_valid
  8. end
  9.  
  10. it "processes asset downloads" do
  11. # Normally created via delayed_job calling method download_assets_for,
  12. # we are going to do it right now instead
  13. p = create(:photograph)
  14. s = build(:synchronization)
  15. puts "SLEEPING"
  16. # By this point, the Photograph has been saved and should appear
  17. # in the test database. If I write below: puts Manager::Photograph.all.inspect,
  18. # it gives me a result set that shows the Photograph was indeed saved
  19. # to the database. However s.download_assets_for(p.class, p.id) raises an
  20. # error ("Couldn't find Manager::Photograph at id:1").
  21. sleep 10
  22. # Expect no errors if the instance should be found
  23. expect { s.download_assets_for(p.class, p.id) }.to_not raise_error
  24. # Expect this error
  25. expect { s.download_assets_for(p.class, 0) }.to raise_error(RuntimeError, "Couldn't find #{ p.class } at id:0")
  26. end
  27.  
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement