1
0
Fork 0
forked from OpenNeo/impress
impress/spec/models/swf_asset_spec.rb

36 lines
1.1 KiB
Ruby
Raw Normal View History

require 'spec_helper'
describe SwfAsset do
it "belongs to a zone" do
asset = Factory.create :swf_asset, :zone_id => 1
asset.zone_id.should == 1
asset.zone.id.should == 1
asset.zone.label.should == 'Music'
end
it "delegates depth to zone" do
asset = Factory.create :swf_asset, :zone_id => 1
asset.depth.should == 1
end
it "converts neopets URL to impress URL" do
asset = Factory.create :swf_asset, :url => 'http://images.neopets.com/cp/items/swf/000/000/012/12211_9969430b3a.swf'
asset.local_url.should == 'http://impress.openneo.net/assets/swf/outfit/items/000/000/012/12211_9969430b3a.swf'
end
2010-06-07 16:50:49 -07:00
it "should contain id, depth, zone ID, and local_url as JSON" do
asset = Factory.create :swf_asset,
:id => 123,
:zone_id => 4,
2010-05-20 17:25:36 -07:00
:body_id => 234,
:url => 'http://images.neopets.com/cp/items/swf/000/000/012/12211_9969430b3a.swf'
asset.as_json.should == {
:id => 123,
:depth => 6,
2010-05-20 17:25:36 -07:00
:body_id => 234,
2010-06-07 16:50:49 -07:00
:local_url => 'http://impress.openneo.net/assets/swf/outfit/items/000/000/012/12211_9969430b3a.swf',
:zone_id => 4
}
end
end