Remove unused automated testing files & gems
Look, I'll be real, I have literally not run these automated tests in probably like a whole decade. Most of these files are empty, the ones that aren't seem basically trivial, and I bet half of it would fail anyway. If I wanted to do real automated testing, I would basically want to start from scratch anyway, and apply coverage I can trust to the areas I actually care about. Until then, I feel like these gems and files are mostly just clutter, and I don't like them being One More Barrier To Entry. Goodbye, unused complexity!
This commit is contained in:
parent
ca50937cb1
commit
13371e3cf2
48 changed files with 0 additions and 694 deletions
6
Gemfile
6
Gemfile
|
@ -65,9 +65,3 @@ gem 'record_tag_helper', '~> 1.0', '>= 1.0.1'
|
||||||
|
|
||||||
# Reduces boot times through caching; required in config/boot.rb
|
# Reduces boot times through caching; required in config/boot.rb
|
||||||
gem 'bootsnap', '~> 1.16', require: false
|
gem 'bootsnap', '~> 1.16', require: false
|
||||||
|
|
||||||
# For testing.
|
|
||||||
group :test do
|
|
||||||
gem 'factory_girl_rails', '~> 4.9'
|
|
||||||
gem 'rspec-rails', '~> 2.0.0.beta.22'
|
|
||||||
end
|
|
||||||
|
|
20
Gemfile.lock
20
Gemfile.lock
|
@ -105,7 +105,6 @@ GEM
|
||||||
warden (~> 1.2.3)
|
warden (~> 1.2.3)
|
||||||
devise-encryptable (0.2.0)
|
devise-encryptable (0.2.0)
|
||||||
devise (>= 2.1.0)
|
devise (>= 2.1.0)
|
||||||
diff-lcs (1.2.5)
|
|
||||||
domain_name (0.5.20190701)
|
domain_name (0.5.20190701)
|
||||||
unf (>= 0.0.5, < 1.0.0)
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
dotenv (2.8.1)
|
dotenv (2.8.1)
|
||||||
|
@ -116,11 +115,6 @@ GEM
|
||||||
ruby2_keywords
|
ruby2_keywords
|
||||||
erubi (1.12.0)
|
erubi (1.12.0)
|
||||||
execjs (2.5.2)
|
execjs (2.5.2)
|
||||||
factory_girl (4.9.0)
|
|
||||||
activesupport (>= 3.0.0)
|
|
||||||
factory_girl_rails (4.9.0)
|
|
||||||
factory_girl (~> 4.9.0)
|
|
||||||
railties (>= 3.0.0)
|
|
||||||
ffi (1.15.5)
|
ffi (1.15.5)
|
||||||
globalid (1.2.1)
|
globalid (1.2.1)
|
||||||
activesupport (>= 6.1)
|
activesupport (>= 6.1)
|
||||||
|
@ -258,18 +252,6 @@ GEM
|
||||||
http-cookie (>= 1.0.2, < 2.0)
|
http-cookie (>= 1.0.2, < 2.0)
|
||||||
mime-types (>= 1.16, < 4.0)
|
mime-types (>= 1.16, < 4.0)
|
||||||
netrc (~> 0.8)
|
netrc (~> 0.8)
|
||||||
rspec (2.0.1)
|
|
||||||
rspec-core (~> 2.0.1)
|
|
||||||
rspec-expectations (~> 2.0.1)
|
|
||||||
rspec-mocks (~> 2.0.1)
|
|
||||||
rspec-core (2.0.1)
|
|
||||||
rspec-expectations (2.0.1)
|
|
||||||
diff-lcs (>= 1.1.2)
|
|
||||||
rspec-mocks (2.0.1)
|
|
||||||
rspec-core (~> 2.0.1)
|
|
||||||
rspec-expectations (~> 2.0.1)
|
|
||||||
rspec-rails (2.0.1)
|
|
||||||
rspec (~> 2.0.0)
|
|
||||||
ruby2_keywords (0.0.5)
|
ruby2_keywords (0.0.5)
|
||||||
sanitize (6.0.2)
|
sanitize (6.0.2)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
|
@ -326,7 +308,6 @@ DEPENDENCIES
|
||||||
devise (~> 4.9, >= 4.9.2)
|
devise (~> 4.9, >= 4.9.2)
|
||||||
devise-encryptable (~> 0.2.0)
|
devise-encryptable (~> 0.2.0)
|
||||||
dotenv-rails (~> 2.8, >= 2.8.1)
|
dotenv-rails (~> 2.8, >= 2.8.1)
|
||||||
factory_girl_rails (~> 4.9)
|
|
||||||
globalize (~> 6.2, >= 6.2.1)
|
globalize (~> 6.2, >= 6.2.1)
|
||||||
haml (~> 6.1, >= 6.1.1)
|
haml (~> 6.1, >= 6.1.1)
|
||||||
http_accept_language (~> 2.1, >= 2.1.1)
|
http_accept_language (~> 2.1, >= 2.1.1)
|
||||||
|
@ -344,7 +325,6 @@ DEPENDENCIES
|
||||||
react-rails (~> 2.7, >= 2.7.1)
|
react-rails (~> 2.7, >= 2.7.1)
|
||||||
record_tag_helper (~> 1.0, >= 1.0.1)
|
record_tag_helper (~> 1.0, >= 1.0.1)
|
||||||
rest-client (~> 2.1)
|
rest-client (~> 2.1)
|
||||||
rspec-rails (~> 2.0.0.beta.22)
|
|
||||||
sanitize (~> 6.0, >= 6.0.2)
|
sanitize (~> 6.0, >= 6.0.2)
|
||||||
sass-rails (~> 6.0)
|
sass-rails (~> 6.0)
|
||||||
sprockets (~> 4.2)
|
sprockets (~> 4.2)
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe BrokenImageReportsController do
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe CampaignsController do
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe ClosetHangersController do
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,19 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe ClosetListsController do
|
|
||||||
|
|
||||||
describe "GET 'new'" do
|
|
||||||
it "should be successful" do
|
|
||||||
get 'new'
|
|
||||||
response.should be_success
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "GET 'create'" do
|
|
||||||
it "should be successful" do
|
|
||||||
get 'create'
|
|
||||||
response.should be_success
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe ClosetPagesController do
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe ItemZoneSetsController do
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe ItemsController do
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,4 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe PetTypesController do
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe SwfAssetsController do
|
|
||||||
|
|
||||||
end
|
|
|
@ -1,15 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
# Specs in this file have access to a helper object that includes
|
|
||||||
# the BrokenImageReportsHelper. For example:
|
|
||||||
#
|
|
||||||
# describe BrokenImageReportsHelper do
|
|
||||||
# describe "string concat" do
|
|
||||||
# it "concats two strings with spaces" do
|
|
||||||
# helper.concat_strings("this","that").should == "this that"
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
describe BrokenImageReportsHelper do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,15 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
# Specs in this file have access to a helper object that includes
|
|
||||||
# the CampaignsHelper. For example:
|
|
||||||
#
|
|
||||||
# describe CampaignsHelper do
|
|
||||||
# describe "string concat" do
|
|
||||||
# it "concats two strings with spaces" do
|
|
||||||
# helper.concat_strings("this","that").should == "this that"
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
describe CampaignsHelper do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,15 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
# Specs in this file have access to a helper object that includes
|
|
||||||
# the ClosetHangersHelper. For example:
|
|
||||||
#
|
|
||||||
# describe ClosetHangersHelper do
|
|
||||||
# describe "string concat" do
|
|
||||||
# it "concats two strings with spaces" do
|
|
||||||
# helper.concat_strings("this","that").should == "this that"
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
describe ClosetHangersHelper do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,15 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
# Specs in this file have access to a helper object that includes
|
|
||||||
# the ClosetListsHelper. For example:
|
|
||||||
#
|
|
||||||
# describe ClosetListsHelper do
|
|
||||||
# describe "string concat" do
|
|
||||||
# it "concats two strings with spaces" do
|
|
||||||
# helper.concat_strings("this","that").should == "this that"
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
describe ClosetListsHelper do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,15 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
# Specs in this file have access to a helper object that includes
|
|
||||||
# the ClosetPagesHelper. For example:
|
|
||||||
#
|
|
||||||
# describe ClosetPagesHelper do
|
|
||||||
# describe "string concat" do
|
|
||||||
# it "concats two strings with spaces" do
|
|
||||||
# helper.concat_strings("this","that").should == "this that"
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
describe ClosetPagesHelper do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require "spec_helper"
|
|
||||||
|
|
||||||
describe DonationMailer do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe Campaign do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe ClosetHanger do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe ClosetList do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,22 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe Color do
|
|
||||||
specify "should find by id, report name" do
|
|
||||||
Color.find(1).name.should == 'alien'
|
|
||||||
Color.find(2).name.should == 'apple'
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should find by name, report id" do
|
|
||||||
Color.find_by_name('alien').id.should == 1
|
|
||||||
Color.find_by_name('apple').id.should == 2
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "name should be case-insensitive" do
|
|
||||||
Color.find_by_name('Alien').id.should == 1
|
|
||||||
Color.find_by_name('alien').id.should == 1
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "class should have list of basic colors" do
|
|
||||||
Color::Basic.map { |c| c.name }.should == ['blue', 'green', 'red', 'yellow']
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe DonationFeature do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe Donation do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe ItemOutfitRelationship do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,250 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe Item do
|
|
||||||
context "an item" do
|
|
||||||
before(:each) do
|
|
||||||
@item = Factory.create :item
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should accept string or array for species_support_ids" do
|
|
||||||
@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 provide list of supported species objects" do
|
|
||||||
@item.species_support_ids = [1, 2, 3]
|
|
||||||
@item.supported_species.map { |s| s.name }.should == ['acara', 'aisha', 'blumaroo']
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should provide all species if no support ids" do
|
|
||||||
@item.species_support_ids = ''
|
|
||||||
@item.supported_species.count.should be > 0
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should have many swf_assets through parent_swf_asset_relationships" do
|
|
||||||
SwfAsset.delete_all
|
|
||||||
ParentSwfAssetRelationship.delete_all
|
|
||||||
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, :swf_asset_type => 'object'
|
|
||||||
end
|
|
||||||
dud_swf_asset = Factory.create :swf_asset, :id => 3, :type => 'object'
|
|
||||||
ParentSwfAssetRelationship.create :swf_asset => dud_swf_asset, :parent_id => 2, :swf_asset_type => 'object'
|
|
||||||
other_type_swf_asset = Factory.create :swf_asset, :id => 4, :type => 'biology'
|
|
||||||
ParentSwfAssetRelationship.create :swf_asset => other_type_swf_asset, :parent_id => 1, :swf_asset_type => 'biology'
|
|
||||||
@item.swf_assets.map(&:id).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
|
|
||||||
|
|
||||||
context "class" do
|
|
||||||
before :each do
|
|
||||||
Item.delete_all # don't want search returning results from previous tests
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should search name for word" do
|
|
||||||
query_should 'blue',
|
|
||||||
:return => [
|
|
||||||
'A Hat That is Blue',
|
|
||||||
'Blue Hat',
|
|
||||||
'Blueish Hat',
|
|
||||||
'Very Blue Hat'
|
|
||||||
],
|
|
||||||
:not_return => [
|
|
||||||
'Green Hat',
|
|
||||||
'Red Hat'
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should search name for phrase" do
|
|
||||||
query_should '"one two"',
|
|
||||||
:return => [
|
|
||||||
'Zero one two three',
|
|
||||||
'Zero one two',
|
|
||||||
'One two three'
|
|
||||||
],
|
|
||||||
:not_return => [
|
|
||||||
'Zero one three',
|
|
||||||
'Zero two three',
|
|
||||||
'Zero one and two',
|
|
||||||
'Three two one'
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should search name for multiple words" do
|
|
||||||
query_should 'one two',
|
|
||||||
:return => [
|
|
||||||
'Zero one two three',
|
|
||||||
'Zero one two',
|
|
||||||
'One two three',
|
|
||||||
'Zero one and two',
|
|
||||||
'Three two one'
|
|
||||||
],
|
|
||||||
:not_return => [
|
|
||||||
'Zero one three',
|
|
||||||
'Zero two three'
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should search name for words and phrases" do
|
|
||||||
query_should 'zero "one two" three',
|
|
||||||
:return => [
|
|
||||||
'zero one two three',
|
|
||||||
'zero four one two three',
|
|
||||||
'one two zero three',
|
|
||||||
'three zero one two'
|
|
||||||
],
|
|
||||||
:not_return => [
|
|
||||||
'one two three',
|
|
||||||
'zero one two',
|
|
||||||
'three one zero two',
|
|
||||||
'two one three zero'
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should search description for words and phrases" do
|
|
||||||
query_should 'description:zero description:"one two"',
|
|
||||||
:return => [
|
|
||||||
['Green Hat', 'zero one two three'],
|
|
||||||
['Blue Hat', 'five one two four zero']
|
|
||||||
],
|
|
||||||
:not_return => [
|
|
||||||
'Zero one two',
|
|
||||||
['Zero one', 'two'],
|
|
||||||
['Zero', 'One two'],
|
|
||||||
['Three', 'One zero two']
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should search by species" do
|
|
||||||
[[2],[1,2,3],[2,3],[3],[1,3]].each do |ids|
|
|
||||||
Factory.create :item, :species_support_ids => ids
|
|
||||||
end
|
|
||||||
Item.search('species:acara').count.should == 2
|
|
||||||
Item.search('species:aisha').count.should == 3
|
|
||||||
Item.search('species:blumaroo').count.should == 4
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should search by species and words" do
|
|
||||||
Factory.create :item, :name => 'Blue Hat', :species_support_ids => [1]
|
|
||||||
Factory.create :item, :name => 'Very Blue Hat', :species_support_ids => [1,2]
|
|
||||||
Factory.create :item, :name => 'Red Hat', :species_support_ids => [2]
|
|
||||||
Item.search('blue species:acara').count.should == 2
|
|
||||||
Item.search('blue species:aisha').count.should == 1
|
|
||||||
Item.search('red species:acara').count.should == 0
|
|
||||||
Item.search('red species:aisha').count.should == 1
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should return items with no species requirements if a species condition is added" do
|
|
||||||
Factory.create :item, :species_support_ids => [1]
|
|
||||||
Factory.create :item, :species_support_ids => [1,2]
|
|
||||||
Factory.create :item, :species_support_ids => []
|
|
||||||
Item.search('species:acara').count.should == 3
|
|
||||||
Item.search('species:aisha').count.should == 2
|
|
||||||
Item.search('species:acara species:aisha').count.should == 2
|
|
||||||
Item.search('-species:acara').count.should == 0
|
|
||||||
Item.search('-species:aisha').count.should == 1
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should search by only:species" do
|
|
||||||
Factory.create :item, :species_support_ids => [1], :name => 'a'
|
|
||||||
Factory.create :item, :species_support_ids => [1,2], :name => 'b'
|
|
||||||
Factory.create :item, :species_support_ids => [], :name => 'c'
|
|
||||||
Item.search('only:acara').map(&:name).should == ['a']
|
|
||||||
Item.search('only:aisha').count.should == 0
|
|
||||||
Item.search('-only:acara').map(&:name).should == ['b', 'c']
|
|
||||||
Item.search('-only:aisha').map(&:name).should == ['a', 'b', 'c']
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should search by is:nc" do
|
|
||||||
Factory.create :item, :name => 'mall', :rarity_index => 500
|
|
||||||
Factory.create :item, :name => 'also mall', :rarity_index => 500
|
|
||||||
Factory.create :item, :name => 'only mall', :rarity_index => 0, :sold_in_mall => true
|
|
||||||
Factory.create :item, :name => 'not mall', :rarity_index => 400
|
|
||||||
Factory.create :item, :name => 'also not mall', :rarity_index => 101
|
|
||||||
Item.search('is:nc').map(&:name).should == ['mall', 'also mall', 'only mall']
|
|
||||||
Item.search('-is:nc').map(&:name).should == ['not mall', 'also not mall']
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should search by is:pb" do
|
|
||||||
descriptions_by_name = {
|
|
||||||
'Aisha Collar' => 'This item is part of a deluxe paint brush set!',
|
|
||||||
'Christmas Buzz Hat' => 'This item is part of a deluxe paint brush set!',
|
|
||||||
'Blue Hat' => 'This item is a trick and is NOT part of a deluxe paint brush set!',
|
|
||||||
'Green Hat' => 'This hat is green.'
|
|
||||||
}
|
|
||||||
descriptions_by_name.each do |name, description|
|
|
||||||
Factory.create :item, :name => name, :description => description
|
|
||||||
end
|
|
||||||
Item.search('is:pb').map(&:name).should == ['Aisha Collar', 'Christmas Buzz Hat']
|
|
||||||
Item.search('-is:pb').map(&:name).should == ['Blue Hat', 'Green Hat']
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "is:[not 'nc' or 'pb'] should throw ArgumentError" do
|
|
||||||
lambda { Item.search('is:nc') }.should_not raise_error(ArgumentError)
|
|
||||||
lambda { Item.search('is:pb') }.should_not raise_error(ArgumentError)
|
|
||||||
lambda { Item.search('is:awesome') }.should raise_error(ArgumentError)
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should be able to negate word in search" do
|
|
||||||
query_should 'hat -blue',
|
|
||||||
:return => [
|
|
||||||
'Green Hat',
|
|
||||||
'Red Hat',
|
|
||||||
'Blu E Hat',
|
|
||||||
],
|
|
||||||
:not_return => [
|
|
||||||
'Blue Hat',
|
|
||||||
'Green Shirt',
|
|
||||||
'Blue Shirt',
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should be able to negate species in search" do
|
|
||||||
Factory.create :item, :name => 'Blue Hat', :species_support_ids => [1]
|
|
||||||
Factory.create :item, :name => 'Very Blue Hat', :species_support_ids => [1,2]
|
|
||||||
Factory.create :item, :name => 'Red Hat', :species_support_ids => [1,2]
|
|
||||||
Factory.create :item, :name => 'Green Hat', :species_support_ids => [3]
|
|
||||||
Factory.create :item, :name => 'Red Shirt', :species_support_ids => [3]
|
|
||||||
Item.search('hat -species:acara').count.should == 1
|
|
||||||
Item.search('hat -species:aisha').count.should == 2
|
|
||||||
Item.search('hat -species:acara -species:aisha').count.should == 1
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should be able to negate phrase in search" do
|
|
||||||
query_should 'zero -"one two"',
|
|
||||||
:return => [
|
|
||||||
'Zero two one',
|
|
||||||
'One three two zero'
|
|
||||||
],
|
|
||||||
:not_return => [
|
|
||||||
'Zero one two',
|
|
||||||
'One two three zero'
|
|
||||||
]
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should raise exception for a query with no conditions" do
|
|
||||||
[
|
|
||||||
lambda { Item.search('').all },
|
|
||||||
lambda { Item.search(nil).all },
|
|
||||||
lambda { Item.search(' ').all }
|
|
||||||
].each { |l| l.should raise_error(ArgumentError) }
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should raise exception for a query that's too short" do
|
|
||||||
lambda { Item.search('e').all }.should raise_error(ArgumentError)
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should not be able to search other attributes thru filters" do
|
|
||||||
lambda { Item.search('id:1').all }.should raise_error(ArgumentError)
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should raise exception if species not found" do
|
|
||||||
lambda { Item.search('species:hurfdurfdurf').all }.should raise_error(ArgumentError)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe Outfit do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,18 +0,0 @@
|
||||||
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 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
|
|
|
@ -1,18 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe PetState do
|
|
||||||
it "has many swf_assets through parent_swf_asset_relationships" do
|
|
||||||
pet_state = Factory.create :pet_state
|
|
||||||
3.times do |n|
|
|
||||||
swf_asset = Factory.create :swf_asset, :id => n, :url => "http://images.neopets.com/#{n}.swf", :type => 'biology'
|
|
||||||
ParentSwfAssetRelationship.create :swf_asset => swf_asset, :pet_state => pet_state, :swf_asset_type => 'biology'
|
|
||||||
end
|
|
||||||
dud_swf_asset = Factory.create :swf_asset, :id => 3, :type => 'object'
|
|
||||||
ParentSwfAssetRelationship.create :swf_asset => dud_swf_asset, :parent_id => 2, :swf_asset_type => 'biology'
|
|
||||||
other_type_swf_asset = Factory.create :swf_asset, :id => 4, :type => 'biology'
|
|
||||||
ParentSwfAssetRelationship.create :swf_asset => other_type_swf_asset, :parent_id => 1, :swf_asset_type => 'object'
|
|
||||||
pet_state.swf_assets.map(&:id).should == [0, 1, 2]
|
|
||||||
pet_state.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
|
|
|
@ -1,47 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe PetType do
|
|
||||||
context "object" do
|
|
||||||
specify "should return id, body_id in JSON" do
|
|
||||||
pet_type = PetType.create :color_id => 2, :species_id => 3, :body_id => 4
|
|
||||||
pet_type.as_json.should == {:id => 1, :body_id => 4}
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should allow setting species object" do
|
|
||||||
pet_type = PetType.new
|
|
||||||
pet_type.species = Species.find(1)
|
|
||||||
pet_type.species_id.should == 1
|
|
||||||
pet_type.species.id.should == 1
|
|
||||||
pet_type.species.name.should == 'acara'
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should allow setting color object" do
|
|
||||||
pet_type = PetType.new
|
|
||||||
pet_type.color = Color.find(1)
|
|
||||||
pet_type.color_id.should == 1
|
|
||||||
pet_type.color.id.should == 1
|
|
||||||
pet_type.color.name.should == 'alien'
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should return image hash if a basic color" do
|
|
||||||
blue = Color.find_by_name('blue')
|
|
||||||
acara = Species.find_by_name('acara')
|
|
||||||
pet_type = PetType.new :color => blue, :species => acara
|
|
||||||
pet_type.image_hash.should == 'mnbztxxn'
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should return nil for image hash if not a basic color" do
|
|
||||||
asparagus = Color.find_by_name('asparagus')
|
|
||||||
acara = Species.find_by_name('acara')
|
|
||||||
pet_type = PetType.new :color => asparagus, :species => acara
|
|
||||||
pet_type.image_hash.should be nil
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "has many pet states" do
|
|
||||||
pet_type = Factory.create :pet_type
|
|
||||||
[1, 1, 2].each { |x| Factory.create :pet_state, :pet_type_id => x }
|
|
||||||
pet_type.pet_state_ids.should == [1, 2]
|
|
||||||
pet_type.pet_states.map(&:id).should == [1, 2]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,18 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe Species do
|
|
||||||
specify "should find by id, report name" do
|
|
||||||
Species.find(1).name.should == 'acara'
|
|
||||||
Species.find(2).name.should == 'aisha'
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "should find by name, report id" do
|
|
||||||
Species.find_by_name('acara').id.should == 1
|
|
||||||
Species.find_by_name('aisha').id.should == 2
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "name should be case-insensitive" do
|
|
||||||
Species.find_by_name('Acara').id.should == 1
|
|
||||||
Species.find_by_name('acara').id.should == 1
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,35 +0,0 @@
|
||||||
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
|
|
||||||
|
|
||||||
it "should contain id, depth, zone ID, and local_url as JSON" do
|
|
||||||
asset = Factory.create :swf_asset,
|
|
||||||
:id => 123,
|
|
||||||
:zone_id => 4,
|
|
||||||
: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,
|
|
||||||
:body_id => 234,
|
|
||||||
:local_url => 'http://impress.openneo.net/assets/swf/outfit/items/000/000/012/12211_9969430b3a.swf',
|
|
||||||
:zone_id => 4
|
|
||||||
}
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,8 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe Zone do
|
|
||||||
specify "should find by id, report label" do
|
|
||||||
Zone.find(1).label.should == 'Music'
|
|
||||||
Zone.find(3).label.should == 'Background'
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,32 +0,0 @@
|
||||||
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
|
||||||
# from the project root directory.
|
|
||||||
ENV["RAILS_ENV"] ||= 'test'
|
|
||||||
require File.dirname(__FILE__) + "/../config/environment" unless defined?(Rails)
|
|
||||||
require 'rspec/rails'
|
|
||||||
|
|
||||||
# Requires supporting files with custom matchers and macros, etc,
|
|
||||||
# in ./support/ and its subdirectories.
|
|
||||||
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
||||||
|
|
||||||
Rspec.configure do |config|
|
|
||||||
# == Mock Framework
|
|
||||||
#
|
|
||||||
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
|
||||||
#
|
|
||||||
# config.mock_with :mocha
|
|
||||||
# config.mock_with :flexmock
|
|
||||||
# config.mock_with :rr
|
|
||||||
config.mock_with :rspec
|
|
||||||
|
|
||||||
# If you'd prefer not to run each of your examples within a transaction,
|
|
||||||
# uncomment the following line.
|
|
||||||
# config.use_transactional_examples = false
|
|
||||||
|
|
||||||
def query_should(query, sets)
|
|
||||||
sets.each { |k,v| sets[k] = v.map { |x| x.is_a?(Array) ? x : [x, ''] } }
|
|
||||||
all_sets = sets[:return] + sets[:not_return]
|
|
||||||
all_sets.each { |s| Factory.create :item, :name => s[0], :description => s[1]}
|
|
||||||
returned_sets = Item.search(query).all.map { |i| [i.name, i.description] }.sort
|
|
||||||
returned_sets.should == sets[:return].sort
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe "closet_lists/create.html.erb" do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe "closet_lists/new.html.erb" do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
describe "petpages/new.html.erb" do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,15 +0,0 @@
|
||||||
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 Time.now
|
|
||||||
end
|
|
|
@ -1,4 +0,0 @@
|
||||||
Factory.define :pet_state do |ps|
|
|
||||||
ps.pet_type_id 1
|
|
||||||
ps.swf_asset_ids_cache '1,2,3'
|
|
||||||
end
|
|
|
@ -1,5 +0,0 @@
|
||||||
Factory.define :pet_type do |pt|
|
|
||||||
pt.color 8 # blue
|
|
||||||
pt.species 1 # acara
|
|
||||||
pt.body_id 1
|
|
||||||
end
|
|
|
@ -1,8 +0,0 @@
|
||||||
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
|
|
||||||
s.add_attribute :type, 'object'
|
|
||||||
s.sequence(:id) { |n| n }
|
|
||||||
end
|
|
BIN
vendor/cache/diff-lcs-1.2.5.gem
vendored
BIN
vendor/cache/diff-lcs-1.2.5.gem
vendored
Binary file not shown.
BIN
vendor/cache/factory_girl-4.9.0.gem
vendored
BIN
vendor/cache/factory_girl-4.9.0.gem
vendored
Binary file not shown.
BIN
vendor/cache/factory_girl_rails-4.9.0.gem
vendored
BIN
vendor/cache/factory_girl_rails-4.9.0.gem
vendored
Binary file not shown.
BIN
vendor/cache/rspec-2.0.1.gem
vendored
BIN
vendor/cache/rspec-2.0.1.gem
vendored
Binary file not shown.
BIN
vendor/cache/rspec-core-2.0.1.gem
vendored
BIN
vendor/cache/rspec-core-2.0.1.gem
vendored
Binary file not shown.
BIN
vendor/cache/rspec-expectations-2.0.1.gem
vendored
BIN
vendor/cache/rspec-expectations-2.0.1.gem
vendored
Binary file not shown.
BIN
vendor/cache/rspec-mocks-2.0.1.gem
vendored
BIN
vendor/cache/rspec-mocks-2.0.1.gem
vendored
Binary file not shown.
BIN
vendor/cache/rspec-rails-2.0.1.gem
vendored
BIN
vendor/cache/rspec-rails-2.0.1.gem
vendored
Binary file not shown.
Loading…
Reference in a new issue