Commit 3381645929b9a52b5f8727becbea699a740cacf4

Authored by Andrew
1 parent 0da9d503

Added value checks for callbacks and mode [skip ci]

Showing 1 changed file with 5 additions and 1 deletions   Show diff stats
lib/searchkick/model.rb
... ... @@ -68,7 +68,7 @@ module Searchkick
68 68  
69 69 callbacks = options.key?(:callbacks) ? options[:callbacks] : true
70 70 unless [true, false, :async, :queue].include?(callbacks)
71   - raise ArgumentError, "Unknown value for callbacks"
  71 + raise ArgumentError, "Invalid value for callbacks"
72 72 end
73 73  
74 74 if callbacks
... ... @@ -83,6 +83,10 @@ module Searchkick
83 83 def reindex(method_name = nil, refresh: false, mode: nil)
84 84 return unless Searchkick.callbacks?
85 85  
  86 + unless [true, nil, :async, :queue].include?(mode)
  87 + raise ArgumentError, "Invalid value for mode"
  88 + end
  89 +
86 90 klass_options = self.class.searchkick_index.options
87 91  
88 92 if mode.nil?
... ...