Skip to content

Commit

Permalink
Add failing spec for Issue #14
Browse files Browse the repository at this point in the history
Thanks to John Shahid for pairing with me and helping to isolate this
issue.
  • Loading branch information
nertzy committed Apr 2, 2013
1 parent f735d55 commit 170d06a
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions spec/integration/associations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 170d06a

Please sign in to comment.