Sha256: 85464e27b0eb9a4f91f1bee17e8fafa7b9064f7376eb58b83bf4251a4991d6da

Contents?: true

Size: 551 Bytes

Versions: 14

Compression:

Stored size: 551 Bytes

Contents

require_relative "test_helper"

class SuggestedIndexesTest < Minitest::Test
  def setup
    # no pg_stat_statements
    skip if ENV["TRAVIS_CI"]

    PgHero.reset_query_stats
  end

  def test_basic
    User.where(email: "person1@example.org").first
    assert_equal [{table: "users", columns: ["email"]}], PgHero.suggested_indexes.map { |q| q.except(:queries, :details) }
  end

  def test_existing_index
    User.where("updated_at > ?", Time.now).to_a
    assert_equal [], PgHero.suggested_indexes.map { |q| q.except(:queries, :details) }
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
pghero-1.7.0 test/suggested_indexes_test.rb
pghero-1.6.5 test/suggested_indexes_test.rb
pghero-1.6.4 test/suggested_indexes_test.rb
pghero-1.6.3 test/suggested_indexes_test.rb
pghero-1.6.2 test/suggested_indexes_test.rb
pghero-1.6.1 test/suggested_indexes_test.rb
pghero-1.6.0 test/suggested_indexes_test.rb
pghero-1.5.3 test/suggested_indexes_test.rb
pghero-1.5.2 test/suggested_indexes_test.rb
pghero-1.5.1 test/suggested_indexes_test.rb
pghero-1.5.0 test/suggested_indexes_test.rb
pghero-1.4.2 test/suggested_indexes_test.rb
pghero-1.4.1 test/suggested_indexes_test.rb
pghero-1.4.0 test/suggested_indexes_test.rb