2010-05-20 16:04:56 -07:00
|
|
|
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
|
2010-06-09 19:56:47 -07:00
|
|
|
asset.zone.label.should == 'Music'
|
2010-05-20 16:04:56 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
it "delegates depth to zone" do
|
|
|
|
asset = Factory.create :swf_asset, :zone_id => 1
|
2010-06-09 19:56:47 -07:00
|
|
|
asset.depth.should == 1
|
2010-05-20 16:04:56 -07:00
|
|
|
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
|
2010-05-20 16:04:56 -07:00
|
|
|
asset = Factory.create :swf_asset,
|
|
|
|
:id => 123,
|
2010-06-09 19:56:47 -07:00
|
|
|
:zone_id => 4,
|
2010-05-20 17:25:36 -07:00
|
|
|
:body_id => 234,
|
2010-05-20 16:04:56 -07:00
|
|
|
:url => 'http://images.neopets.com/cp/items/swf/000/000/012/12211_9969430b3a.swf'
|
|
|
|
asset.as_json.should == {
|
|
|
|
:id => 123,
|
2010-06-09 19:56:47 -07:00
|
|
|
: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',
|
2010-06-09 19:56:47 -07:00
|
|
|
:zone_id => 4
|
2010-05-20 16:04:56 -07:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|