Commit 5979937ea9640ef6921a98b846589a025690396e
1 parent
ca46e74a
Exists in
master
and in
2 other branches
Added tests for index_name and index_prefix options
Showing
1 changed file
with
25 additions
and
0 deletions
Show diff stats
test/index_options_test.rb
... | ... | @@ -3,6 +3,7 @@ require_relative "test_helper" |
3 | 3 | class IndexOptionsTest < Minitest::Test |
4 | 4 | def setup |
5 | 5 | Song.destroy_all |
6 | + Song.instance_variable_set(:@searchkick_index_name, nil) | |
6 | 7 | end |
7 | 8 | |
8 | 9 | def test_case_sensitive |
... | ... | @@ -66,6 +67,30 @@ class IndexOptionsTest < Minitest::Test |
66 | 67 | end |
67 | 68 | end |
68 | 69 | |
70 | + def test_index_name | |
71 | + with_options({index_name: "songs_v2"}) do | |
72 | + assert_equal "songs_v2", Song.search_index.name | |
73 | + end | |
74 | + end | |
75 | + | |
76 | + def test_index_name_callable | |
77 | + with_options({index_name: -> { "songs_v2" }}) do | |
78 | + assert_equal "songs_v2", Song.search_index.name | |
79 | + end | |
80 | + end | |
81 | + | |
82 | + def test_index_prefix | |
83 | + with_options({index_prefix: "hello"}) do | |
84 | + assert_equal "hello_songs_test", Song.search_index.name | |
85 | + end | |
86 | + end | |
87 | + | |
88 | + def test_index_prefix_callable | |
89 | + with_options({index_prefix: -> { "hello" }}) do | |
90 | + assert_equal "hello_songs_test", Song.search_index.name | |
91 | + end | |
92 | + end | |
93 | + | |
69 | 94 | def default_model |
70 | 95 | Song |
71 | 96 | end | ... | ... |