Skip to content
Browse files

Move generally-useful classes into spec helper.

  • Loading branch information...
1 parent adbeff2 commit 09a58b199970de7d05d908eaa961088cadf3a780 @benhamill benhamill committed Jul 8, 2012
Showing with 17 additions and 15 deletions.
  1. +2 −2 Rakefile
  2. +15 −0 spec/spec_helper.rb
  3. +0 −1 spec/texticle/full_text_indexer_spec.rb
  4. +0 −12 spec/texticle/searchable_spec.rb
View
4 Rakefile
@@ -72,9 +72,9 @@ task :console do
end
task :test do
- require 'texticle_spec'
+ # require 'texticle_spec'
require 'texticle/searchable_spec'
- require 'texticle/full_text_indexer_spec'
+ # require 'texticle/full_text_indexer_spec'
end
namespace :db do
View
15 spec/spec_helper.rb
@@ -5,6 +5,8 @@
require 'shoulda'
require 'pry'
require 'active_record'
+require 'texticle'
+require 'texticle/searchable'
config = YAML.load_file File.expand_path(File.dirname(__FILE__) + '/config.yml')
ActiveRecord::Base.establish_connection config.merge(:adapter => :postgresql)
@@ -17,6 +19,19 @@ class WebComic < ActiveRecord::Base
has_many :characters
end
+class WebComicWithSearchable < WebComic
+ extend Searchable
+end
+
+class WebComicWithSearchableName < WebComic
+ extend Searchable(:name)
+end
+
+class WebComicWithSearchableNameAndAuthor < WebComic
+ extend Searchable(:name, :author)
+end
+
+
class Character < ActiveRecord::Base
# string :name
# string :description
View
1 spec/texticle/full_text_indexer_spec.rb
@@ -1,6 +1,5 @@
require 'spec_helper'
require 'fileutils'
-require 'texticle/searchable'
class FullTextIndexerTest < Test::Unit::TestCase
context ".stream_output" do
View
12 spec/texticle/searchable_spec.rb
@@ -4,10 +4,6 @@
class SearchableTest < Test::Unit::TestCase
context "when extending an ActiveRecord::Base subclass" do
context "with no parameters" do
- class WebComicWithSearchable < WebComic
- extend Searchable
- end
-
setup do
@qcont = WebComicWithSearchable.create :name => "Questionable Content", :author => "Jeph Jaques"
@jhony = WebComicWithSearchable.create :name => "Johnny Wander", :author => "Ananth & Yuko"
@@ -26,10 +22,6 @@ class WebComicWithSearchable < WebComic
end
context "with one column as parameter" do
- class WebComicWithSearchableName < WebComic
- extend Searchable(:name)
- end
-
setup do
@qcont = WebComicWithSearchableName.create :name => "Questionable Content", :author => "Jeph Jaques"
@jhony = WebComicWithSearchableName.create :name => "Johnny Wander", :author => "Ananth & Yuko"
@@ -80,10 +72,6 @@ class WebComicWithSearchableName < WebComic
end
context "with two columns as parameters" do
- class WebComicWithSearchableNameAndAuthor < WebComic
- extend Searchable(:name, :author)
- end
-
setup do
@qcont = WebComicWithSearchableNameAndAuthor.create :name => "Questionable Content", :author => "Jeph Jaques"
@jhony = WebComicWithSearchableNameAndAuthor.create :name => "Johnny Wander", :author => "Ananth & Yuko"

0 comments on commit 09a58b1

Please sign in to comment.
Something went wrong with that request. Please try again.