Permalink
Browse files

Add failing spec for Github issue #88

  • Loading branch information...
1 parent d4eb75a commit 540800c1f785bee69f68e6d764beaf0e3253e635 @nertzy nertzy committed with nertzy Mar 9, 2013
Showing with 26 additions and 0 deletions.
  1. +26 −0 spec/integration/associations_spec.rb
@@ -524,4 +524,30 @@
expect(results).not_to include(*excluded)
end
end
+
+ describe "a scope that uses :associated_against and is chained onto another scope that joins to the same association" do
+ with_model :Parent do
+ model do
+ include PgSearch
+ has_one :child
+ pg_search_scope :search, associated_against: {:child => :name}
+ def self.enabled
+ joins(:child).where(:children => {:enabled => true})
+ end
+ end
+ end
+
+ with_model :Child do
+ table do |t|
+ t.string :name
+ t.belongs_to :parent
+ end
+ end
+
+ it "should not raise an exception" do
+ expect {
+ Parent.search("test").enabled.to_a
+ }.not_to raise_exception
+ end
+ end
end

0 comments on commit 540800c

Please sign in to comment.