Permalink
Browse files

Add failing spec for Issue #14

Thanks to John Shahid for pairing with me and helping to isolate this
issue.
  • Loading branch information...
1 parent f735d55 commit 170d06a21addae1d710003ae470441acf6401ad7 @nertzy nertzy committed Apr 2, 2013
Showing with 36 additions and 0 deletions.
  1. +36 −0 spec/integration/associations_spec.rb
@@ -343,6 +343,42 @@
results.should_not include(excluded)
end
end
+
+ context "when including the associated model" do
+ with_model :Parent do
+ table do |t|
+ t.text :name
+ end
+
+ model do
+ has_many :children
+ include PgSearch
+ pg_search_scope :search_name, :against => :name
+ end
+ end
+
+ with_model :Child do
+ table do |t|
+ t.belongs_to :parent
+ end
+
+ model do
+ belongs_to :parent
+ end
+ end
+
+ # https://github.com/Casecommons/pg_search/issues/14
+ it "supports queries with periods" do
+ included = Parent.create!(:name => 'bar.foo')
+ excluded = Parent.create!(:name => 'foo.bar')
+
+ results = Parent.search_name('bar.foo').includes(:children)
+ results.to_a
+
+ results.should include(included)
+ results.should_not include(excluded)
+ end
+ end
end
context "merging a pg_search_scope into another model's scope" do

0 comments on commit 170d06a

Please sign in to comment.