Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'spec_helper'
- describe Manager::Synchronization do
- it "contains all parameters" do
- build_stubbed(:synchronization, elapsed_time: nil).should_not be_valid
- build_stubbed(:synchronization, updated_records: nil).should_not be_valid
- end
- it "processes asset downloads" do
- # Normally created via delayed_job calling method download_assets_for,
- # we are going to do it right now instead
- p = create(:photograph)
- s = build(:synchronization)
- puts "SLEEPING"
- # By this point, the Photograph has been saved and should appear
- # in the test database. If I write below: puts Manager::Photograph.all.inspect,
- # it gives me a result set that shows the Photograph was indeed saved
- # to the database. However s.download_assets_for(p.class, p.id) raises an
- # error ("Couldn't find Manager::Photograph at id:1").
- sleep 10
- # Expect no errors if the instance should be found
- expect { s.download_assets_for(p.class, p.id) }.to_not raise_error
- # Expect this error
- expect { s.download_assets_for(p.class, 0) }.to raise_error(RuntimeError, "Couldn't find #{ p.class } at id:0")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement