diff --git a/app/models/gem_download.rb b/app/models/gem_download.rb index 8462392ec01..237f3e98441 100644 --- a/app/models/gem_download.rb +++ b/app/models/gem_download.rb @@ -135,7 +135,7 @@ def downloads_by_gem(rubygem_ids) end def update_query(id, downloads, version_downloads) - { update: { _index: "rubygems-#{Rails.env}", + { update: { _index: Gemcutter::SEARCH_INDEX_NAME, _id: id, data: { doc: { downloads: downloads, version_downloads: version_downloads } } } } end diff --git a/test/helpers/es_helper.rb b/test/helpers/es_helper.rb index 47552fd0548..396ccb7f67d 100644 --- a/test/helpers/es_helper.rb +++ b/test/helpers/es_helper.rb @@ -18,6 +18,6 @@ def es_version_downloads(id) def get_response(id) Rubygem.searchkick_index.refresh - Searchkick.client.get index: "rubygems-#{Rails.env}", id: id + Searchkick.client.get index: Gemcutter::SEARCH_INDEX_NAME, id: id end end diff --git a/test/models/deletion_test.rb b/test/models/deletion_test.rb index 032f82c923c..81c5363d88f 100644 --- a/test/models/deletion_test.rb +++ b/test/models/deletion_test.rb @@ -160,8 +160,7 @@ class DeletionTest < ActiveSupport::TestCase perform_enqueued_jobs - response = Searchkick.client.get index: "rubygems-#{Rails.env}", - id: @version.rubygem_id + response = Searchkick.client.get index: Gemcutter::SEARCH_INDEX_NAME, id: @version.rubygem_id assert response["_source"]["yanked"] end diff --git a/test/models/pusher_test.rb b/test/models/pusher_test.rb index 14fd53443cd..3e2e409af67 100644 --- a/test/models/pusher_test.rb +++ b/test/models/pusher_test.rb @@ -627,8 +627,7 @@ def two_cert_chain(signing_key:, root_not_before: Time.current, cert_not_before: should "create rubygem index" do @rubygem.update_column("updated_at", Date.new(2016, 07, 04)) perform_enqueued_jobs only: ReindexRubygemJob - response = Searchkick.client.get index: "rubygems-#{Rails.env}", - id: @rubygem.id + response = Searchkick.client.get index: Gemcutter::SEARCH_INDEX_NAME, id: @rubygem.id expected_response = { "name" => "gemsgemsgems", "downloads" => 0, @@ -733,8 +732,7 @@ def two_cert_chain(signing_key:, root_not_before: Time.current, cert_not_before: should "update rubygem index" do perform_enqueued_jobs only: ReindexRubygemJob - response = Searchkick.client.get index: "rubygems-#{Rails.env}", - id: @rubygem.id + response = Searchkick.client.get index: Gemcutter::SEARCH_INDEX_NAME, id: @rubygem.id assert_equal "new summary", response["_source"]["summary"] end