Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move all class defs to spec_helper.

  • Loading branch information...
commit 827645fbe1ad386040e5be84f21f1a9d356e1732 1 parent 67ca14f
@benhamill benhamill authored
Showing with 30 additions and 27 deletions.
  1. +1 −1  Rakefile
  2. +29 −0 spec/spec_helper.rb
  3. +0 −26 spec/texticle_spec.rb
View
2  Rakefile
@@ -72,7 +72,7 @@ task :console do
end
task :test do
- # require 'texticle_spec'
+ require 'texticle_spec'
require 'texticle/searchable_spec'
require 'texticle/full_text_indexer_spec'
end
View
29 spec/spec_helper.rb
@@ -11,6 +11,19 @@
config = YAML.load_file File.expand_path(File.dirname(__FILE__) + '/config.yml')
ActiveRecord::Base.establish_connection config.merge(:adapter => :postgresql)
+class ARStandIn < ActiveRecord::Base;
+ self.abstract_class = true
+ extend Texticle
+end
+
+class NotThere < ARStandIn; end
+
+class TexticleWebComic < ARStandIn;
+ has_many :characters, :foreign_key => :web_comic_id
+ self.table_name = :web_comics
+end
+
+
class WebComic < ActiveRecord::Base
# string :name
# string :author
@@ -40,10 +53,26 @@ class Character < ActiveRecord::Base
belongs_to :web_comic
end
+
class Game < ActiveRecord::Base
# string :system
# string :title
# text :description
end
+class GameExtendedWithTexticle < Game
+ extend Texticle
+end
+
+class GameExtendedWithTexticleAndCustomLanguage < GameExtendedWithTexticle
+ def searchable_language
+ 'spanish'
+ end
+end
+
+
class GameFail < Game; end
+
+class GameFailExtendedWithTexticle < GameFail
+ extend Texticle
+end
View
26 spec/texticle_spec.rb
@@ -3,18 +3,6 @@
class TexticleTest < Test::Unit::TestCase
context "after extending ActiveRecord::Base" do
-
- # set up modules so that Texticle won't be forever mixed into ActiveRecord
- class ARStandIn < ActiveRecord::Base;
- self.abstract_class = true
- extend Texticle
- end
- class NotThere < ARStandIn; end
- class TexticleWebComic < ARStandIn;
- has_many :characters, :foreign_key => :web_comic_id
- self.table_name = :web_comics
- end
-
should "not break #respond_to?" do
assert_nothing_raised do
ARStandIn.respond_to? :abstract_class?
@@ -81,14 +69,6 @@ class TexticleWebComic < ARStandIn;
end
context "after extending an ActiveRecord::Base subclass" do
- class GameExtendedWithTexticle < Game
- extend Texticle
- end
-
- class GameFailExtendedWithTexticle < GameFail
- extend Texticle
- end
-
setup do
@zelda = GameExtendedWithTexticle.create :system => "NES", :title => "Legend of Zelda", :description => "A Link to the Past."
@mario = GameExtendedWithTexticle.create :system => "NES", :title => "Super Mario Bros.", :description => "The original platformer."
@@ -220,12 +200,6 @@ class GameFailExtendedWithTexticle < GameFail
end
context "when setting a custom search language" do
- class GameExtendedWithTexticleAndCustomLanguage < GameExtendedWithTexticle
- def searchable_language
- 'spanish'
- end
- end
-
setup do
GameExtendedWithTexticleAndCustomLanguage.create :system => "PS3", :title => "Harry Potter & the Deathly Hallows"
end
Please sign in to comment.
Something went wrong with that request. Please try again.