Skip to content

Commit

Permalink
Raise error when including (instead of extending) PgSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
amarshall committed Dec 12, 2013
1 parent a182d28 commit 7a548e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/pg_search.rb
Expand Up @@ -55,6 +55,10 @@ def extended mod
mod.send :include, Compatibility::ActiveRecord3
end

def included _
raise 'extend PgSearch instead of including it'
end

def multisearch(*args)
PgSearch::Document.search(*args)
end
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/pg_search_spec.rb
@@ -0,0 +1,9 @@
require 'spec_helper'

describe PgSearch do
it "raises an error when included" do
expect do
Module.new { include PgSearch }
end.to raise_error 'extend PgSearch instead of including it'
end
end

0 comments on commit 7a548e0

Please sign in to comment.