Skip to content

Commit

Permalink
Use Gemcutter::SEARCH_INDEX_NAME consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
martinemde committed Dec 10, 2024
1 parent f9a6417 commit 776be60
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/gem_download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/es_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions test/models/deletion_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions test/models/pusher_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 776be60

Please sign in to comment.