From 230026597b6fcf65d00c2fedc2e9c1928ec750d5 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sun, 16 May 2010 15:01:38 -0400 Subject: [PATCH] groundwork for preview, swf asset and relationship model --- app/controllers/swf_assets_controller.rb | 5 + app/helpers/items_helper.rb | 10 + app/models/item.rb | 4 + app/models/parent_swf_asset_relationship.rb | 16 ++ app/models/pet_type.rb | 2 + app/models/species.rb | 13 + app/models/swf_asset.rb | 3 + app/stylesheets/items/_show.scss | 14 + app/views/items/show.html.haml | 12 + app/views/layouts/items.html.haml | 1 + config/routes.rb | 3 + config/standard_type_hashes.yml | 270 ++++++++++++++++++ db/migrate/20100514224031_create_objects.rb | 14 - ...100515020945_add_description_to_objects.rb | 9 - db/schema.rb | 108 ++++++- public/javascripts/items/show.js | 12 + public/stylesheets/compiled/screen.css | 14 + .../controllers/swf_assets_controller_spec.rb | 5 + spec/models/item_spec.rb | 23 +- .../parent_swf_asset_relationship_spec.rb | 23 ++ spec/models/swf_asset_spec.rb | 5 + spec/views/swf_assets/index.html.erb_spec.rb | 5 + test/factories/item.rb | 12 + test/factories/swf_asset.rb | 6 + 24 files changed, 555 insertions(+), 34 deletions(-) create mode 100644 app/controllers/swf_assets_controller.rb create mode 100644 app/models/parent_swf_asset_relationship.rb create mode 100644 app/models/pet_type.rb create mode 100644 app/models/swf_asset.rb create mode 100644 config/standard_type_hashes.yml delete mode 100644 db/migrate/20100514224031_create_objects.rb delete mode 100644 db/migrate/20100515020945_add_description_to_objects.rb create mode 100644 public/javascripts/items/show.js create mode 100644 spec/controllers/swf_assets_controller_spec.rb create mode 100644 spec/models/parent_swf_asset_relationship_spec.rb create mode 100644 spec/models/swf_asset_spec.rb create mode 100644 spec/views/swf_assets/index.html.erb_spec.rb create mode 100644 test/factories/swf_asset.rb diff --git a/app/controllers/swf_assets_controller.rb b/app/controllers/swf_assets_controller.rb new file mode 100644 index 00000000..6403047a --- /dev/null +++ b/app/controllers/swf_assets_controller.rb @@ -0,0 +1,5 @@ +class SwfAssetsController < ApplicationController + def index + render :json => Item.find(params[:item_id]).swf_assets + end +end diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb index cff0c9fe..aff665ae 100644 --- a/app/helpers/items_helper.rb +++ b/app/helpers/items_helper.rb @@ -1,2 +1,12 @@ module ItemsHelper + StandardSpeciesImageFormat = 'http://pets.neopets.com/cp/%s/1/1.png' + + def standard_species_images + colors = Species::StandardColors + raw(Species.all.inject('') do |html, species| + color = colors[rand(colors.size)] + src = sprintf(StandardSpeciesImageFormat, species.hash_for_color(color)) + html + image_tag(src, 'data-color' => color, 'data-species' => species.name) + end) + end end diff --git a/app/models/item.rb b/app/models/item.rb index a89e731e..57e4b7e1 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -5,6 +5,9 @@ class Item < ActiveRecord::Base cattr_reader :per_page @@per_page = 30 + has_many :parent_swf_asset_relationships, :foreign_key => 'parent_id' + has_many :swf_assets, :through => :parent_swf_asset_relationships + scope :alphabetize, order('name ASC') # Not defining validations, since this app is currently read-only @@ -14,6 +17,7 @@ class Item < ActiveRecord::Base end def species_support_ids=(replacement) + @species_support_ids_array = nil replacement = replacement.join(',') if replacement.is_a?(Array) write_attribute('species_support_ids', replacement) end diff --git a/app/models/parent_swf_asset_relationship.rb b/app/models/parent_swf_asset_relationship.rb new file mode 100644 index 00000000..e533c641 --- /dev/null +++ b/app/models/parent_swf_asset_relationship.rb @@ -0,0 +1,16 @@ +class ParentSwfAssetRelationship < ActiveRecord::Base + set_table_name 'parents_swf_assets' + + belongs_to :parent, :class_name => 'Item' + belongs_to :swf_asset + + default_scope where(Table('parents_swf_assets')[:swf_asset_type].eq('object')) + + def item + parent + end + + def item=(replacement) + self.parent = replacement + end +end diff --git a/app/models/pet_type.rb b/app/models/pet_type.rb new file mode 100644 index 00000000..56f61d69 --- /dev/null +++ b/app/models/pet_type.rb @@ -0,0 +1,2 @@ +class PetType < ActiveRecord::Base +end diff --git a/app/models/species.rb b/app/models/species.rb index c6257788..ce91eada 100644 --- a/app/models/species.rb +++ b/app/models/species.rb @@ -1,3 +1,5 @@ +require 'yaml' + class Species attr_accessor :id, :name @@ -10,6 +12,17 @@ class Species species.name = name end + StandardColors = %w(blue green yellow red) + StandardHashes = YAML::load_file(Rails.root.join('config', 'standard_type_hashes.yml')) + + def hash_for_color(color) + StandardHashes[name][color] + end + + def self.all + @objects + end + def self.find(id) @objects[id-1] end diff --git a/app/models/swf_asset.rb b/app/models/swf_asset.rb new file mode 100644 index 00000000..ae157ba8 --- /dev/null +++ b/app/models/swf_asset.rb @@ -0,0 +1,3 @@ +class SwfAsset < ActiveRecord::Base + set_inheritance_column 'inheritance_type' +end diff --git a/app/stylesheets/items/_show.scss b/app/stylesheets/items/_show.scss index 8a22481a..60061bed 100644 --- a/app/stylesheets/items/_show.scss +++ b/app/stylesheets/items/_show.scss @@ -18,4 +18,18 @@ body.show { @include inline-block; margin-top: 1em; } + + #item-preview div { + float: left; + width: 50%; + } + + #item-preview-swf { + height: 50%; + } + + #item-preview img { + height: 50px; + width: 50px; + } } diff --git a/app/views/items/show.html.haml b/app/views/items/show.html.haml index 8e99bbe1..3a2519df 100644 --- a/app/views/items/show.html.haml +++ b/app/views/items/show.html.haml @@ -3,3 +3,15 @@ %h2#item-name= @item.name %p= @item.description + +%h3 Preview + +#item-preview + #item-preview-species= standard_species_images + #item-preview-swf + Javascript and Flash are required to preview wearables. Sorry! + +- content_for :javascripts do + = javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js', + 'http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js', + 'items/show' diff --git a/app/views/layouts/items.html.haml b/app/views/layouts/items.html.haml index 5383f33e..1eb4f3b0 100644 --- a/app/views/layouts/items.html.haml +++ b/app/views/layouts/items.html.haml @@ -11,3 +11,4 @@ = text_field_tag :q, @query = submit_tag 'Search', :name => nil = yield + = yield(:javascripts) diff --git a/config/routes.rb b/config/routes.rb index 2a13bcbc..6b4a9574 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,7 @@ OpenneoImpressItems::Application.routes.draw do |map| + get "swf_assets/index" + match '/' => 'items#index', :as => :items match '/:id' => 'items#show', :as => :item + match '/:item_id/swf_assets.json' => 'swf_assets#index', :as => :item_swf_assets end diff --git a/config/standard_type_hashes.yml b/config/standard_type_hashes.yml new file mode 100644 index 00000000..51923a06 --- /dev/null +++ b/config/standard_type_hashes.yml @@ -0,0 +1,270 @@ +acara: + blue: mnbztxxn + green: obxdjm88 + red: 7njwqlq8 + yellow: o3wj6s77 +aisha: + blue: n9ozx4z5 + green: vw3j5rnt + red: r27dkxdc + yellow: t4osnjxq +blumaroo: + blue: 8dng4bvh + green: xmqmg3m9 + red: j77lzlmx + yellow: kfonqhdc +bori: + blue: cdtgf7jo + green: 6c8dvw76 + red: tg7hx55j + yellow: sc2hhvhn +bruce: + blue: w3hljbx7 + green: gwgc67tt + red: 72d26x2b + yellow: wqz8xn4t +buzz: + blue: rkvgtzv3 + green: schfx5c4 + red: gddkkb5j + yellow: jc9klfxm +chia: + blue: d65mc9gf + green: 8d4949sr + red: 4lrb4n3f + yellow: oqs3kzmf +chomby: + blue: h3qctoxg + green: 552mzx7r + red: 9swsd8ln + yellow: bdml26md +cybunny: + blue: v8shwcoq + green: xl6msllv + red: lfkscvgd + yellow: cwlv6zz9 +draik: + blue: 2g4jtrfh + green: 438o4dv5 + red: vd2joxxq + yellow: bob39shq +elephante: + blue: 4ckkjxjj + green: r22hl9oh + red: jhhhbrww + yellow: jf9ww4om +eyrie: + blue: m5mvxv23 + green: s42o6oon + red: 6kngmhvs + yellow: d6b8fqnm +flotsam: + blue: hwdo7rlb + green: 47vt32x2 + red: xhob45wn + yellow: r8r7jmvr +gelert: + blue: 4g7n9mh5 + green: jfmwlmk8 + red: l95vq4w2 + yellow: 5nrd2lvd +gnorbu: + blue: 6c275jcg + green: ghfgo5tn + red: qozzjgmg + yellow: 5lrvftfb +grarrl: + blue: j7q65fv4 + green: t3mstkl6 + red: r946sq53 + yellow: jtg67z98 +grundo: + blue: nwx8v2rb + green: 5xn4kjf8 + red: qjcb6t8x + yellow: n2g9d94f +hissi: + blue: 7ls55f33 + green: dz5dwsbx + red: jsfvcqwt + yellow: z24m7h7l +ixi: + blue: ro3qcd6s + green: w32r74vo + red: zs2m6862 + yellow: oggkzvq7 +jetsam: + blue: w3rl2k9n + green: cwss4w3s + red: ghddf93g + yellow: kz43rnld +jubjub: + blue: 8mf5gzov + green: m267j935 + red: szckt2tj + yellow: 78hdsnmw +kacheek: + blue: tvnq2l5s + green: fkzfcb47 + red: 9hbtocjh + yellow: 4gsrb59g +kau: + blue: ktlxmrtr + green: x9ww69qo + red: mrdtwkto + yellow: 78w49w7x +kiko: + blue: 2qlfqqnd + green: 42j5q3zx + red: mcodrwlt + yellow: 86b5xdn6 +koi: + blue: tjvv5cq8 + green: ncfn87wk + red: f3wvzz6r + yellow: 4f6cvzgh +korbat: + blue: 4qxwv7w7 + green: d2ow9co8 + red: omx9c876 + yellow: nsxodd8z +kougra: + blue: rfsbh59t + green: otvq569n + red: x8hsckbh + yellow: x7bbg59h +krawk: + blue: hxgsm5d4 + green: 7ngw8z4f + red: kzwxb3dn + yellow: m2gq59r5 +kyrii: + blue: ojmo7qgg + green: t3b8s9nz + red: 6fvg9ngs + yellow: blxmjgbk +lenny: + blue: jfc75n44 + green: 242k4kdq + red: kc4w238d + yellow: 8r94jhfq +lupe: + blue: r552fqj8 + green: ohmx4lc9 + red: 6jwlghsg + yellow: z42535zh +lutari: + blue: qgg6z8s7 + green: wtjv7hw4 + red: lgws33oo + yellow: 8x37fgjf +meerca: + blue: wwwhjf88 + green: lg9bb6tf + red: v7g8w8w6 + yellow: kk2nn2jr +moehog: + blue: moot839l + green: jgkoro5z + red: dk47mfk8 + yellow: g84ovct7 +mynci: + blue: xwlo9657 + green: s33qzokw + red: f828tkrc + yellow: tdfhsndr +nimmo: + blue: bx7fho8x + green: mb4mcwj5 + red: mok2fcl4 + yellow: 9559onds +ogrin: + blue: 26v2sx49 + green: lg5bzqkq + red: 3xgoz429 + yellow: rjzmx24v +peophin: + blue: 996t7zfg + green: c9qo7zzt + red: kokc52kh + yellow: 4khvfnwl +poogle: + blue: 5n2vx7v2 + green: fw6lvf3c + red: xhcwbdd5 + yellow: xozlhd68 +pteri: + blue: 82d369sm + green: slqmqr78 + red: tjhwbro3 + yellow: 4gkkb57f +quiggle: + blue: 4zs6b32m + green: vbrsgqrl + red: xrmt72wr + yellow: jdto7mj4 +ruki: + blue: qsgbm5f6 + green: vgml65cz + red: sm55zs3q + yellow: n43szv42 +scorchio: + blue: ohb3b486 + green: kmb82xw8 + red: hkjoncsx + yellow: hgfofbl2 +shoyru: + blue: dj7n2zk8 + green: 3qwwn4n2 + red: 3zb2s2zw + yellow: mmvn4tkg +skeith: + blue: 7c847jkn + green: qdgwwz6c + red: fc4cxk3t + yellow: 533nc7rj +techo: + blue: vl8qro4r + green: 2zc3vd47 + red: zgl2gjjn + yellow: 84gvowmj +tonu: + blue: jd433863 + green: 6mcv27mn + red: oskw3hqd + yellow: 5bhqs7sv +tuskaninny: + blue: jj6t6cqd + green: stl4mm78 + red: 48z4o75j + yellow: q39wn6vq +uni: + blue: 74xvb24d + green: njzvoflw + red: jzfbdomk + yellow: 5qdfrtcq +usul: + blue: xff976n8 + green: 5245lzmh + red: rox4mgh5 + yellow: vxn8b4vr +wocky: + blue: xonntr5f + green: 4ssorlcs + red: 743smd5v + yellow: dnr2kj4b +xweetok: + blue: ddhdrt2o + green: thzwbqsq + red: tdkqr2b6 + yellow: o36btnbf +yurble: + blue: nhn5lxb4 + green: mjgbr7vb + red: h95cs547 + yellow: vfqkbvv6 +zafara: + blue: x8c57g2l + green: tq56zj3x + red: n32sgrvm + yellow: onxr95x6 diff --git a/db/migrate/20100514224031_create_objects.rb b/db/migrate/20100514224031_create_objects.rb deleted file mode 100644 index 7f74fa9c..00000000 --- a/db/migrate/20100514224031_create_objects.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateObjects < ActiveRecord::Migration - def self.up - create_table :objects do |t| - t.string :name - t.string :species_support_ids - - t.timestamps - end - end - - def self.down - drop_table :objects - end -end diff --git a/db/migrate/20100515020945_add_description_to_objects.rb b/db/migrate/20100515020945_add_description_to_objects.rb deleted file mode 100644 index 747cbfca..00000000 --- a/db/migrate/20100515020945_add_description_to_objects.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddDescriptionToObjects < ActiveRecord::Migration - def self.up - add_column :objects, :description, :text - end - - def self.down - remove_column :objects, :description - end -end diff --git a/db/schema.rb b/db/schema.rb index 32eff455..1f50b014 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,14 +9,110 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20100515020945) do +ActiveRecord::Schema.define(:version => 24) do + + create_table "auth_servers", :force => true do |t| + t.string "short_name", :limit => 10, :null => false + t.string "name", :limit => 40, :null => false + t.text "icon", :null => false + t.text "gateway", :null => false + t.string "secret", :limit => 64, :null => false + end + + create_table "contributions", :force => true do |t| + t.string "contributed_class", :limit => 0, :null => false + t.integer "contributed_id", :null => false + t.integer "user_id", :null => false + t.timestamp "created_at", :null => false + end + + create_table "login_cookies", :force => true do |t| + t.integer "user_id", :null => false + t.integer "series", :null => false + t.integer "token", :null => false + end + + add_index "login_cookies", ["user_id", "series"], :name => "login_cookies_user_id_and_series" + add_index "login_cookies", ["user_id"], :name => "login_cookies_user_id" create_table "objects", :force => true do |t| - t.string "name" - t.string "species_support_ids" - t.datetime "created_at" - t.datetime "updated_at" - t.text "description" + t.text "zones_restrict", :limit => 255, :null => false + t.text "thumbnail_url", :null => false + t.string "name", :limit => 100, :null => false + t.text "description", :null => false + t.string "category", :limit => 50, :null => false + t.string "type", :limit => 50, :null => false + t.string "rarity", :limit => 25, :null => false + t.integer "rarity_index", :limit => 1, :null => false + t.integer "price", :limit => 3, :null => false + t.integer "weight_lbs", :limit => 2, :null => false + t.text "species_support_ids" + t.integer "sold_in_mall", :limit => 1, :null => false + t.timestamp "last_spidered" + end + + add_index "objects", ["last_spidered"], :name => "objects_last_spidered" + add_index "objects", ["name"], :name => "name" + + create_table "parents_swf_assets", :id => false, :force => true do |t| + t.integer "parent_id", :limit => 3, :null => false + t.integer "swf_asset_id", :limit => 3, :null => false + t.string "swf_asset_type", :limit => 0 + end + + add_index "parents_swf_assets", ["parent_id", "swf_asset_id", "swf_asset_type"], :name => "unique_parents_swf_assets", :unique => true + add_index "parents_swf_assets", ["parent_id"], :name => "parent_swf_assets_parent_id" + add_index "parents_swf_assets", ["swf_asset_id"], :name => "parents_swf_assets_swf_asset_id" + + create_table "pet_states", :force => true do |t| + t.integer "pet_type_id", :limit => 3, :null => false + t.text "swf_asset_ids", :limit => 255, :null => false + end + + add_index "pet_states", ["pet_type_id"], :name => "pet_states_pet_type_id" + + create_table "pet_types", :force => true do |t| + t.integer "color_id", :limit => 1, :null => false + t.integer "species_id", :limit => 1, :null => false + t.timestamp "created_at", :null => false + t.integer "body_id", :limit => 2, :null => false + t.string "image_hash", :limit => 8 + end + + add_index "pet_types", ["species_id", "color_id"], :name => "pet_types_species_color", :unique => true + + create_table "pets", :force => true do |t| + t.string "name", :limit => 20, :null => false + t.integer "pet_type_id", :limit => 3, :null => false + end + + add_index "pets", ["name"], :name => "pets_name", :unique => true + add_index "pets", ["pet_type_id"], :name => "pets_pet_type_id" + + create_table "swf_assets", :id => false, :force => true do |t| + t.string "type", :limit => 0, :null => false + t.integer "id", :limit => 3, :null => false + t.text "url", :null => false + t.integer "zone_id", :limit => 1, :null => false + t.text "zones_restrict", :limit => 255, :null => false + t.timestamp "created_at", :null => false + t.integer "body_id", :limit => 2, :null => false + end + + add_index "swf_assets", ["body_id"], :name => "swf_assets_body_id_and_object_id" + + create_table "users", :force => true do |t| + t.string "name", :limit => 20, :null => false + t.integer "auth_server_id", :limit => 1, :null => false + t.integer "remote_id", :null => false + t.integer "points", :null => false + end + + create_table "zones", :force => true do |t| + t.integer "depth", :limit => 1, :null => false + t.integer "type_id", :limit => 1, :null => false + t.string "type", :limit => 40, :null => false + t.string "label", :limit => 40, :null => false end end diff --git a/public/javascripts/items/show.js b/public/javascripts/items/show.js new file mode 100644 index 00000000..abaab6a5 --- /dev/null +++ b/public/javascripts/items/show.js @@ -0,0 +1,12 @@ +var PREVIEW_SWF_ID = 'item-preview-swf'; + +swfobject.embedSWF( + 'http://impress.openneo.net/assets/swf/preview.swf', // URL + PREVIEW_SWF_ID, // ID + 400, // width + 400, // height + 9, // required version + 'http://impress.openneo.net/assets/js/swfobject/expressInstall.swf', // express install URL + {'swf_assets_path': '/assets'}, // flashvars + {'wmode': 'transparent'} // params +) diff --git a/public/stylesheets/compiled/screen.css b/public/stylesheets/compiled/screen.css index 73fb9e4d..567c32be 100644 --- a/public/stylesheets/compiled/screen.css +++ b/public/stylesheets/compiled/screen.css @@ -567,3 +567,17 @@ body.show #item-name { *vertical-align: auto; margin-top: 1em; } +/* line 22, ../../../app/stylesheets/items/_show.scss */ +body.show #item-preview div { + float: left; + width: 50%; +} +/* line 27, ../../../app/stylesheets/items/_show.scss */ +body.show #item-preview-swf { + height: 50%; +} +/* line 31, ../../../app/stylesheets/items/_show.scss */ +body.show #item-preview img { + height: 50px; + width: 50px; +} diff --git a/spec/controllers/swf_assets_controller_spec.rb b/spec/controllers/swf_assets_controller_spec.rb new file mode 100644 index 00000000..20e27a7a --- /dev/null +++ b/spec/controllers/swf_assets_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe SwfAssetsController do + +end diff --git a/spec/models/item_spec.rb b/spec/models/item_spec.rb index 34c4af6e..af0d439d 100644 --- a/spec/models/item_spec.rb +++ b/spec/models/item_spec.rb @@ -2,12 +2,25 @@ require 'spec_helper' describe Item do context "an item" do + before(:each) do + @item = Factory.build :item + end + specify "should accept string or array for species_support_ids" do - items = [ - Factory.build(:item, :species_support_ids => '1,2,3'), - Factory.build(:item, :species_support_ids => [1,2,3]) - ] - items.each { |i| i.species_support_ids.should == [1,2,3] } + @item.species_support_ids = '1,2,3' + @item.species_support_ids.should == [1, 2, 3] + @item.species_support_ids = [4, 5, 6] + @item.species_support_ids.should == [4, 5, 6] + end + + specify "should have many swf_assets through parent_swf_asset_relationships" do + 3.times do |n| + swf_asset = Factory.create :swf_asset, :id => n, :url => "http://images.neopets.com/#{n}.swf", :type => 'object' + ParentSwfAssetRelationship.create :swf_asset => swf_asset, :item => @item + end + @item.swf_asset_ids.should == [0, 1, 2] + @item.swf_assets.map(&:url).should == ['http://images.neopets.com/0.swf', + 'http://images.neopets.com/1.swf', 'http://images.neopets.com/2.swf'] end end diff --git a/spec/models/parent_swf_asset_relationship_spec.rb b/spec/models/parent_swf_asset_relationship_spec.rb new file mode 100644 index 00000000..1cacf76e --- /dev/null +++ b/spec/models/parent_swf_asset_relationship_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +describe ParentSwfAssetRelationship do + context "a relationship" do + before(:each) do + @relationship = ParentSwfAssetRelationship.new + Factory.create :item, :name => 'foo' + @relationship.parent_id = 1 + end + + specify "should belong to an item" do + @relationship.item.id.should == 1 + @relationship.item.name.should == 'foo' + end + + specify "should belong to an swf_asset" do + Factory.create :swf_asset, :type => 'object', :id => 1 + @relationship.swf_asset_id = 1 + @relationship.swf_asset.id.should == 1 + @relationship.swf_asset.type.should == 'object' + end + end +end diff --git a/spec/models/swf_asset_spec.rb b/spec/models/swf_asset_spec.rb new file mode 100644 index 00000000..c5f12347 --- /dev/null +++ b/spec/models/swf_asset_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe SwfAsset do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/swf_assets/index.html.erb_spec.rb b/spec/views/swf_assets/index.html.erb_spec.rb new file mode 100644 index 00000000..82973ee1 --- /dev/null +++ b/spec/views/swf_assets/index.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe "swf_assets/index.html.erb" do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/test/factories/item.rb b/test/factories/item.rb index 7822c435..24513e69 100644 --- a/test/factories/item.rb +++ b/test/factories/item.rb @@ -1,3 +1,15 @@ Factory.define :item do |i| i.name 'Test Item' + i.description 'Test Description' + i.thumbnail_url 'http://images.neopets.com/foo.gif' + i.zones_restrict '' + i.category '' + i.add_attribute :type, '' + i.rarity 0 + i.rarity_index 0 + i.price 0 + i.weight_lbs 0 + i.species_support_ids '' + i.sold_in_mall false + i.last_spidered 0 end diff --git a/test/factories/swf_asset.rb b/test/factories/swf_asset.rb new file mode 100644 index 00000000..1152a86c --- /dev/null +++ b/test/factories/swf_asset.rb @@ -0,0 +1,6 @@ +Factory.define :swf_asset do |s| + s.url 'http://images.neopets.com/cp/bio/swf/000/000/000/0000_a1b2c3d4e5.swf' + s.zone_id 0 + s.zones_restrict '' + s.body_id 0 +end