pg_search 2.1.4 → 2.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -4
  3. data/.travis.yml +27 -25
  4. data/CHANGELOG.md +4 -0
  5. data/Gemfile +4 -4
  6. data/README.md +184 -151
  7. data/Rakefile +1 -5
  8. data/lib/pg_search.rb +1 -1
  9. data/lib/pg_search/configuration.rb +2 -2
  10. data/lib/pg_search/document.rb +3 -3
  11. data/lib/pg_search/features/dmetaphone.rb +1 -1
  12. data/lib/pg_search/features/feature.rb +1 -1
  13. data/lib/pg_search/migration/templates/create_pg_search_documents.rb.erb +1 -1
  14. data/lib/pg_search/multisearch.rb +1 -1
  15. data/lib/pg_search/multisearchable.rb +4 -4
  16. data/lib/pg_search/scope_options.rb +13 -28
  17. data/lib/pg_search/version.rb +1 -1
  18. data/pg_search.gemspec +1 -2
  19. data/spec/integration/associations_spec.rb +100 -100
  20. data/spec/integration/pagination_spec.rb +7 -7
  21. data/spec/integration/pg_search_spec.rb +225 -225
  22. data/spec/integration/single_table_inheritance_spec.rb +14 -14
  23. data/spec/lib/pg_search/configuration/association_spec.rb +5 -5
  24. data/spec/lib/pg_search/configuration/foreign_column_spec.rb +1 -1
  25. data/spec/lib/pg_search/features/dmetaphone_spec.rb +2 -2
  26. data/spec/lib/pg_search/features/trigram_spec.rb +1 -1
  27. data/spec/lib/pg_search/features/tsearch_spec.rb +12 -12
  28. data/spec/lib/pg_search/multisearch/rebuilder_spec.rb +10 -10
  29. data/spec/lib/pg_search/multisearch_spec.rb +5 -5
  30. data/spec/lib/pg_search/multisearchable_spec.rb +26 -26
  31. data/spec/lib/pg_search/normalizer_spec.rb +5 -5
  32. data/spec/lib/pg_search_spec.rb +30 -30
  33. data/spec/spec_helper.rb +1 -1
  34. data/spec/support/database.rb +12 -19
  35. metadata +4 -18
@@ -12,7 +12,7 @@ describe "a pg_search_scope on an STI subclass" do
12
12
 
13
13
  model do
14
14
  include PgSearch
15
- pg_search_scope :search_content, :against => :content
15
+ pg_search_scope :search_content, against: :content
16
16
  end
17
17
  end
18
18
 
@@ -23,14 +23,14 @@ describe "a pg_search_scope on an STI subclass" do
23
23
 
24
24
  it "returns only results for that subclass" do
25
25
  included = [
26
- SearchableSubclassModel.create!(:content => "foo bar")
26
+ SearchableSubclassModel.create!(content: "foo bar")
27
27
  ]
28
28
  excluded = [
29
- SearchableSubclassModel.create!(:content => "baz"),
30
- SuperclassModel.create!(:content => "foo bar"),
31
- SuperclassModel.create!(:content => "baz"),
32
- AnotherSearchableSubclassModel.create!(:content => "foo bar"),
33
- AnotherSearchableSubclassModel.create!(:content => "baz")
29
+ SearchableSubclassModel.create!(content: "baz"),
30
+ SuperclassModel.create!(content: "foo bar"),
31
+ SuperclassModel.create!(content: "baz"),
32
+ AnotherSearchableSubclassModel.create!(content: "foo bar"),
33
+ AnotherSearchableSubclassModel.create!(content: "baz")
34
34
  ]
35
35
 
36
36
  expect(SuperclassModel.count).to eq(6)
@@ -53,7 +53,7 @@ describe "a pg_search_scope on an STI subclass" do
53
53
  model do
54
54
  include PgSearch
55
55
  self.inheritance_column = 'custom_type'
56
- pg_search_scope :search_content, :against => :content
56
+ pg_search_scope :search_content, against: :content
57
57
  end
58
58
  end
59
59
 
@@ -64,14 +64,14 @@ describe "a pg_search_scope on an STI subclass" do
64
64
 
65
65
  it "returns only results for that subclass" do
66
66
  included = [
67
- SearchableSubclassModel.create!(:content => "foo bar")
67
+ SearchableSubclassModel.create!(content: "foo bar")
68
68
  ]
69
69
  excluded = [
70
- SearchableSubclassModel.create!(:content => "baz"),
71
- SuperclassModel.create!(:content => "foo bar"),
72
- SuperclassModel.create!(:content => "baz"),
73
- AnotherSearchableSubclassModel.create!(:content => "foo bar"),
74
- AnotherSearchableSubclassModel.create!(:content => "baz")
70
+ SearchableSubclassModel.create!(content: "baz"),
71
+ SuperclassModel.create!(content: "foo bar"),
72
+ SuperclassModel.create!(content: "baz"),
73
+ AnotherSearchableSubclassModel.create!(content: "foo bar"),
74
+ AnotherSearchableSubclassModel.create!(content: "baz")
75
75
  ]
76
76
 
77
77
  expect(SuperclassModel.count).to eq(6)
@@ -18,11 +18,11 @@ describe PgSearch::Configuration::Association do
18
18
 
19
19
  model do
20
20
  include PgSearch
21
- has_one :avatar, :class_name => "Avatar"
21
+ has_one :avatar, class_name: "Avatar"
22
22
  belongs_to :site
23
23
 
24
- pg_search_scope :with_avatar, :associated_against => { :avatar => :url }
25
- pg_search_scope :with_site, :associated_against => { :site => :title }
24
+ pg_search_scope :with_avatar, associated_against: { avatar: :url }
25
+ pg_search_scope :with_site, associated_against: { site: :title }
26
26
  end
27
27
  end
28
28
 
@@ -33,9 +33,9 @@ describe PgSearch::Configuration::Association do
33
33
 
34
34
  model do
35
35
  include PgSearch
36
- has_many :users, :class_name => "User"
36
+ has_many :users, class_name: "User"
37
37
 
38
- pg_search_scope :with_users, :associated_against => { :users => :name }
38
+ pg_search_scope :with_users, associated_against: { users: :name }
39
39
  end
40
40
  end
41
41
 
@@ -20,7 +20,7 @@ describe PgSearch::Configuration::ForeignColumn do
20
20
  include PgSearch
21
21
  belongs_to :another_model, class_name: 'AssociatedModel'
22
22
 
23
- pg_search_scope :with_another, :associated_against => { :another_model => :title }
23
+ pg_search_scope :with_another, associated_against: { another_model: :title }
24
24
  end
25
25
  end
26
26
 
@@ -18,7 +18,7 @@ describe PgSearch::Features::DMetaphone do
18
18
  PgSearch::Configuration::Column.new(:content, nil, Model)
19
19
  ]
20
20
  options = {}
21
- config = double(:config, :ignore => [])
21
+ config = double(:config, ignore: [])
22
22
  normalizer = PgSearch::Normalizer.new(config)
23
23
 
24
24
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -43,7 +43,7 @@ describe PgSearch::Features::DMetaphone do
43
43
  PgSearch::Configuration::Column.new(:content, nil, Model)
44
44
  ]
45
45
  options = {}
46
- config = double(:config, :ignore => [])
46
+ config = double(:config, ignore: [])
47
47
  normalizer = PgSearch::Normalizer.new(config)
48
48
 
49
49
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -14,7 +14,7 @@ describe PgSearch::Features::Trigram do
14
14
  ]
15
15
  }
16
16
  let(:normalizer) { PgSearch::Normalizer.new(config) }
17
- let(:config) { OpenStruct.new(:ignore => []) }
17
+ let(:config) { OpenStruct.new(ignore: []) }
18
18
 
19
19
  let(:coalesced_columns) do
20
20
  <<-SQL.strip_heredoc.chomp
@@ -19,7 +19,7 @@ describe PgSearch::Features::TSearch do
19
19
  PgSearch::Configuration::Column.new(:content, nil, Model)
20
20
  ]
21
21
  options = {}
22
- config = double(:config, :ignore => [])
22
+ config = double(:config, ignore: [])
23
23
  normalizer = PgSearch::Normalizer.new(config)
24
24
 
25
25
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -44,7 +44,7 @@ describe PgSearch::Features::TSearch do
44
44
  PgSearch::Configuration::Column.new(:content, nil, Model)
45
45
  ]
46
46
  options = {}
47
- config = double(:config, :ignore => [])
47
+ config = double(:config, ignore: [])
48
48
  normalizer = PgSearch::Normalizer.new(config)
49
49
 
50
50
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -60,8 +60,8 @@ describe PgSearch::Features::TSearch do
60
60
  PgSearch::Configuration::Column.new(:name, nil, Model),
61
61
  PgSearch::Configuration::Column.new(:content, nil, Model)
62
62
  ]
63
- options = { :negation => true }
64
- config = double(:config, :ignore => [])
63
+ options = { negation: true }
64
+ config = double(:config, ignore: [])
65
65
  normalizer = PgSearch::Normalizer.new(config)
66
66
 
67
67
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -78,8 +78,8 @@ describe PgSearch::Features::TSearch do
78
78
  PgSearch::Configuration::Column.new(:name, nil, Model),
79
79
  PgSearch::Configuration::Column.new(:content, nil, Model)
80
80
  ]
81
- options = { :negation => false }
82
- config = double(:config, :ignore => [])
81
+ options = { negation: false }
82
+ config = double(:config, ignore: [])
83
83
  normalizer = PgSearch::Normalizer.new(config)
84
84
 
85
85
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -97,7 +97,7 @@ describe PgSearch::Features::TSearch do
97
97
  PgSearch::Configuration::Column.new(:content, nil, Model)
98
98
  ]
99
99
  options = { tsvector_column: "my_tsvector" }
100
- config = double(:config, :ignore => [])
100
+ config = double(:config, ignore: [])
101
101
  normalizer = PgSearch::Normalizer.new(config)
102
102
 
103
103
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -115,7 +115,7 @@ describe PgSearch::Features::TSearch do
115
115
  PgSearch::Configuration::Column.new(:content, nil, Model)
116
116
  ]
117
117
  options = { tsvector_column: ["tsvector1", "tsvector2"] }
118
- config = double(:config, :ignore => [])
118
+ config = double(:config, ignore: [])
119
119
  normalizer = PgSearch::Normalizer.new(config)
120
120
 
121
121
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -141,7 +141,7 @@ describe PgSearch::Features::TSearch do
141
141
  ]
142
142
  options = {}
143
143
 
144
- config = double(:config, :ignore => [])
144
+ config = double(:config, ignore: [])
145
145
  normalizer = PgSearch::Normalizer.new(config)
146
146
 
147
147
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -165,7 +165,7 @@ describe PgSearch::Features::TSearch do
165
165
  }
166
166
  }
167
167
 
168
- config = double(:config, :ignore => [])
168
+ config = double(:config, ignore: [])
169
169
  normalizer = PgSearch::Normalizer.new(config)
170
170
 
171
171
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -195,7 +195,7 @@ describe PgSearch::Features::TSearch do
195
195
  }
196
196
  }
197
197
 
198
- config = double(:config, :ignore => [])
198
+ config = double(:config, ignore: [])
199
199
  normalizer = PgSearch::Normalizer.new(config)
200
200
 
201
201
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -223,7 +223,7 @@ describe PgSearch::Features::TSearch do
223
223
  }
224
224
  }
225
225
 
226
- config = double(:config, :ignore => [])
226
+ config = double(:config, ignore: [])
227
227
  normalizer = PgSearch::Normalizer.new(config)
228
228
 
229
229
  feature = described_class.new(query, options, columns, Model, normalizer)
@@ -10,7 +10,7 @@ end
10
10
  describe PgSearch::Multisearch::Rebuilder do
11
11
  with_table "pg_search_documents", {}, &DOCUMENTS_SCHEMA
12
12
 
13
- describe 'when intialized with a model that is not multisearchable' do
13
+ describe 'when initialized with a model that is not multisearchable' do
14
14
  with_model :not_multisearchable
15
15
 
16
16
  it 'raises an exception' do
@@ -80,7 +80,7 @@ describe PgSearch::Multisearch::Rebuilder do
80
80
 
81
81
  model do
82
82
  include PgSearch
83
- multisearchable :against => :name
83
+ multisearchable against: :name
84
84
  end
85
85
  end
86
86
 
@@ -142,7 +142,7 @@ describe PgSearch::Multisearch::Rebuilder do
142
142
 
143
143
  model do
144
144
  include PgSearch
145
- multisearchable :against => :name
145
+ multisearchable against: :name
146
146
  end
147
147
  end
148
148
 
@@ -161,7 +161,7 @@ describe PgSearch::Multisearch::Rebuilder do
161
161
 
162
162
  model do
163
163
  include PgSearch
164
- multisearchable :against => :name
164
+ multisearchable against: :name
165
165
  end
166
166
  end
167
167
 
@@ -247,13 +247,13 @@ describe PgSearch::Multisearch::Rebuilder do
247
247
 
248
248
  model do
249
249
  include PgSearch
250
- multisearchable :if => :active?
250
+ multisearchable if: :active?
251
251
  end
252
252
  end
253
253
 
254
254
  it "calls update_pg_search_document on each record" do
255
- record_1 = Model.create!(:active => true)
256
- record_2 = Model.create!(:active => false)
255
+ record_1 = Model.create!(active: true)
256
+ record_2 = Model.create!(active: false)
257
257
 
258
258
  rebuilder = PgSearch::Multisearch::Rebuilder.new(Model)
259
259
 
@@ -283,13 +283,13 @@ describe PgSearch::Multisearch::Rebuilder do
283
283
 
284
284
  model do
285
285
  include PgSearch
286
- multisearchable :unless => :inactive?
286
+ multisearchable unless: :inactive?
287
287
  end
288
288
  end
289
289
 
290
290
  it "calls update_pg_search_document on each record" do
291
- record_1 = Model.create!(:inactive => true)
292
- record_2 = Model.create!(:inactive => false)
291
+ record_1 = Model.create!(inactive: true)
292
+ record_2 = Model.create!(inactive: false)
293
293
 
294
294
  rebuilder = PgSearch::Multisearch::Rebuilder.new(Model)
295
295
 
@@ -22,7 +22,7 @@ describe PgSearch::Multisearch do
22
22
 
23
23
  describe ".rebuild" do
24
24
  before do
25
- model.multisearchable :against => :title
25
+ model.multisearchable against: :title
26
26
  end
27
27
 
28
28
  it "should operate inside a transaction" do
@@ -98,8 +98,8 @@ describe PgSearch::Multisearch do
98
98
  describe "inserting the new documents" do
99
99
  let!(:new_models) { [] }
100
100
  before do
101
- new_models << model.create!(:title => "Foo", :content => "Bar")
102
- new_models << model.create!(:title => "Baz", :content => "Bar")
101
+ new_models << model.create!(title: "Foo", content: "Bar")
102
+ new_models << model.create!(title: "Baz", content: "Bar")
103
103
  end
104
104
 
105
105
  it "should create new documents for the two models" do
@@ -114,7 +114,7 @@ describe PgSearch::Multisearch do
114
114
 
115
115
  context "with one attribute" do
116
116
  before do
117
- model.multisearchable :against => [:title]
117
+ model.multisearchable against: [:title]
118
118
  end
119
119
 
120
120
  it "should generate the proper SQL code" do
@@ -141,7 +141,7 @@ describe PgSearch::Multisearch do
141
141
 
142
142
  context "with multiple attributes" do
143
143
  before do
144
- model.multisearchable :against => %i[title content]
144
+ model.multisearchable against: %i[title content]
145
145
  end
146
146
 
147
147
  it "should generate the proper SQL code" do
@@ -22,7 +22,7 @@ describe PgSearch::Multisearchable do
22
22
  include PgSearch
23
23
  multisearchable
24
24
 
25
- has_many :multisearchable_children, :dependent => :destroy
25
+ has_many :multisearchable_children, dependent: :destroy
26
26
  end
27
27
  end
28
28
 
@@ -145,7 +145,7 @@ describe PgSearch::Multisearchable do
145
145
  end
146
146
 
147
147
  context "when searching against a single column" do
148
- let(:multisearchable_options) { { :against => :some_content } }
148
+ let(:multisearchable_options) { { against: :some_content } }
149
149
  let(:text) { "foo bar" }
150
150
  before do
151
151
  allow(record).to receive(:some_content) { text }
@@ -159,7 +159,7 @@ describe PgSearch::Multisearchable do
159
159
  end
160
160
 
161
161
  context "when searching against multiple columns" do
162
- let(:multisearchable_options) { { :against => %i[attr1 attr2] } }
162
+ let(:multisearchable_options) { { against: %i[attr1 attr2] } }
163
163
  before do
164
164
  allow(record).to receive(:attr1) { '1' }
165
165
  allow(record).to receive(:attr2) { '2' }
@@ -182,7 +182,7 @@ describe PgSearch::Multisearchable do
182
182
  end
183
183
 
184
184
  context "when searching against a single column" do
185
- let(:multisearchable_options) { { :against => :some_content } }
185
+ let(:multisearchable_options) { { against: :some_content } }
186
186
  let(:text) { "foo bar" }
187
187
  before do
188
188
  allow(record).to receive(:some_content) { text }
@@ -196,7 +196,7 @@ describe PgSearch::Multisearchable do
196
196
  end
197
197
 
198
198
  context "when searching against multiple columns" do
199
- let(:multisearchable_options) { { :against => %i[attr1 attr2] } }
199
+ let(:multisearchable_options) { { against: %i[attr1 attr2] } }
200
200
  before do
201
201
  allow(record).to receive(:attr1) { '1' }
202
202
  allow(record).to receive(:attr2) { '2' }
@@ -212,7 +212,7 @@ describe PgSearch::Multisearchable do
212
212
  context "with additional_attributes" do
213
213
  let(:multisearchable_options) do
214
214
  {
215
- :additional_attributes => lambda do |record|
215
+ additional_attributes: lambda do |record|
216
216
  { foo: record.bar }
217
217
  end
218
218
  }
@@ -231,7 +231,7 @@ describe PgSearch::Multisearchable do
231
231
  context "when selectively updating" do
232
232
  let(:multisearchable_options) do
233
233
  {
234
- :update_if => lambda do |record|
234
+ update_if: lambda do |record|
235
235
  record.bar?
236
236
  end
237
237
  }
@@ -288,7 +288,7 @@ describe PgSearch::Multisearchable do
288
288
 
289
289
  model do
290
290
  include PgSearch
291
- multisearchable :if => ->(record) { record.multisearchable? }
291
+ multisearchable if: ->(record) { record.multisearchable? }
292
292
  end
293
293
  end
294
294
 
@@ -296,7 +296,7 @@ describe PgSearch::Multisearchable do
296
296
  describe "after_create" do
297
297
  describe "saving the record" do
298
298
  context "when the condition is true" do
299
- let(:record) { ModelThatIsMultisearchable.new(:multisearchable => true) }
299
+ let(:record) { ModelThatIsMultisearchable.new(multisearchable: true) }
300
300
 
301
301
  it "should create a PgSearch::Document record" do
302
302
  expect { record.save! }.to change(PgSearch::Document, :count).by(1)
@@ -312,7 +312,7 @@ describe PgSearch::Multisearchable do
312
312
  end
313
313
 
314
314
  context "when the condition is false" do
315
- let(:record) { ModelThatIsMultisearchable.new(:multisearchable => false) }
315
+ let(:record) { ModelThatIsMultisearchable.new(multisearchable: false) }
316
316
 
317
317
  it "should not create a PgSearch::Document record" do
318
318
  expect { record.save! }.not_to change(PgSearch::Document, :count)
@@ -322,7 +322,7 @@ describe PgSearch::Multisearchable do
322
322
  end
323
323
 
324
324
  describe "after_update" do
325
- let(:record) { ModelThatIsMultisearchable.create!(:multisearchable => true) }
325
+ let(:record) { ModelThatIsMultisearchable.create!(multisearchable: true) }
326
326
 
327
327
  context "when the document is present" do
328
328
  before { expect(record.pg_search_document).to be_present }
@@ -397,7 +397,7 @@ describe PgSearch::Multisearchable do
397
397
  end
398
398
 
399
399
  describe "after_destroy" do
400
- let(:record) { ModelThatIsMultisearchable.create!(:multisearchable => true) }
400
+ let(:record) { ModelThatIsMultisearchable.create!(multisearchable: true) }
401
401
 
402
402
  it "should remove its document" do
403
403
  document = record.pg_search_document
@@ -416,7 +416,7 @@ describe PgSearch::Multisearchable do
416
416
 
417
417
  model do
418
418
  include PgSearch
419
- multisearchable :unless => ->(record) { record.not_multisearchable? }
419
+ multisearchable unless: ->(record) { record.not_multisearchable? }
420
420
  end
421
421
  end
422
422
 
@@ -424,7 +424,7 @@ describe PgSearch::Multisearchable do
424
424
  describe "after_create" do
425
425
  describe "saving the record" do
426
426
  context "when the condition is false" do
427
- let(:record) { ModelThatIsMultisearchable.new(:not_multisearchable => false) }
427
+ let(:record) { ModelThatIsMultisearchable.new(not_multisearchable: false) }
428
428
 
429
429
  it "should create a PgSearch::Document record" do
430
430
  expect { record.save! }.to change(PgSearch::Document, :count).by(1)
@@ -440,7 +440,7 @@ describe PgSearch::Multisearchable do
440
440
  end
441
441
 
442
442
  context "when the condition is true" do
443
- let(:record) { ModelThatIsMultisearchable.new(:not_multisearchable => true) }
443
+ let(:record) { ModelThatIsMultisearchable.new(not_multisearchable: true) }
444
444
 
445
445
  it "should not create a PgSearch::Document record" do
446
446
  expect { record.save! }.not_to change(PgSearch::Document, :count)
@@ -450,7 +450,7 @@ describe PgSearch::Multisearchable do
450
450
  end
451
451
 
452
452
  describe "after_update" do
453
- let!(:record) { ModelThatIsMultisearchable.create!(:not_multisearchable => false) }
453
+ let!(:record) { ModelThatIsMultisearchable.create!(not_multisearchable: false) }
454
454
 
455
455
  context "when the document is present" do
456
456
  before { expect(record.pg_search_document).to be_present }
@@ -545,7 +545,7 @@ describe PgSearch::Multisearchable do
545
545
 
546
546
  model do
547
547
  include PgSearch
548
- multisearchable :if => :multisearchable?
548
+ multisearchable if: :multisearchable?
549
549
  end
550
550
  end
551
551
 
@@ -553,7 +553,7 @@ describe PgSearch::Multisearchable do
553
553
  describe "after_create" do
554
554
  describe "saving the record" do
555
555
  context "when the condition is true" do
556
- let(:record) { ModelThatIsMultisearchable.new(:multisearchable => true) }
556
+ let(:record) { ModelThatIsMultisearchable.new(multisearchable: true) }
557
557
 
558
558
  it "should create a PgSearch::Document record" do
559
559
  expect { record.save! }.to change(PgSearch::Document, :count).by(1)
@@ -569,7 +569,7 @@ describe PgSearch::Multisearchable do
569
569
  end
570
570
 
571
571
  context "when the condition is false" do
572
- let(:record) { ModelThatIsMultisearchable.new(:multisearchable => false) }
572
+ let(:record) { ModelThatIsMultisearchable.new(multisearchable: false) }
573
573
 
574
574
  it "should not create a PgSearch::Document record" do
575
575
  expect { record.save! }.not_to change(PgSearch::Document, :count)
@@ -579,7 +579,7 @@ describe PgSearch::Multisearchable do
579
579
  end
580
580
 
581
581
  describe "after_update" do
582
- let!(:record) { ModelThatIsMultisearchable.create!(:multisearchable => true) }
582
+ let!(:record) { ModelThatIsMultisearchable.create!(multisearchable: true) }
583
583
 
584
584
  context "when the document is present" do
585
585
  before { expect(record.pg_search_document).to be_present }
@@ -658,7 +658,7 @@ describe PgSearch::Multisearchable do
658
658
  end
659
659
 
660
660
  describe "after_destroy" do
661
- let(:record) { ModelThatIsMultisearchable.create!(:multisearchable => true) }
661
+ let(:record) { ModelThatIsMultisearchable.create!(multisearchable: true) }
662
662
 
663
663
  it "should remove its document" do
664
664
  document = record.pg_search_document
@@ -677,7 +677,7 @@ describe PgSearch::Multisearchable do
677
677
 
678
678
  model do
679
679
  include PgSearch
680
- multisearchable :unless => :not_multisearchable?
680
+ multisearchable unless: :not_multisearchable?
681
681
  end
682
682
  end
683
683
 
@@ -685,7 +685,7 @@ describe PgSearch::Multisearchable do
685
685
  describe "after_create" do
686
686
  describe "saving the record" do
687
687
  context "when the condition is true" do
688
- let(:record) { ModelThatIsMultisearchable.new(:not_multisearchable => true) }
688
+ let(:record) { ModelThatIsMultisearchable.new(not_multisearchable: true) }
689
689
 
690
690
  it "should not create a PgSearch::Document record" do
691
691
  expect { record.save! }.not_to change(PgSearch::Document, :count)
@@ -693,7 +693,7 @@ describe PgSearch::Multisearchable do
693
693
  end
694
694
 
695
695
  context "when the condition is false" do
696
- let(:record) { ModelThatIsMultisearchable.new(:not_multisearchable => false) }
696
+ let(:record) { ModelThatIsMultisearchable.new(not_multisearchable: false) }
697
697
 
698
698
  it "should create a PgSearch::Document record" do
699
699
  expect { record.save! }.to change(PgSearch::Document, :count).by(1)
@@ -711,7 +711,7 @@ describe PgSearch::Multisearchable do
711
711
  end
712
712
 
713
713
  describe "after_update" do
714
- let!(:record) { ModelThatIsMultisearchable.create!(:not_multisearchable => false) }
714
+ let!(:record) { ModelThatIsMultisearchable.create!(not_multisearchable: false) }
715
715
 
716
716
  context "when the document is present" do
717
717
  before { expect(record.pg_search_document).to be_present }
@@ -790,7 +790,7 @@ describe PgSearch::Multisearchable do
790
790
  end
791
791
 
792
792
  describe "after_destroy" do
793
- let(:record) { ModelThatIsMultisearchable.create!(:not_multisearchable => false) }
793
+ let(:record) { ModelThatIsMultisearchable.create!(not_multisearchable: false) }
794
794
 
795
795
  it "should remove its document" do
796
796
  document = record.pg_search_document