Sha256: 4ad27e2b7c744f3b10da7acdc83c646474036af05313c92923ecc2234938c337

Contents?: true

Size: 488 Bytes

Versions: 3

Compression:

Stored size: 488 Bytes

Contents

describe "arel-mysql-index-hint" do
  describe "#preload" do
    subject do
      User.
        where(id: 1).
        preload(:microposts).
        hint(users: {index_users_on_email: hint_type}).
        to_sql.gsub(/\s+/, " ")
    end

    let(:sql) do
      "SELECT `users`.* " +
      "FROM `users` " +
      "#{hint_type.to_s.upcase} INDEX (`index_users_on_email`) " +
      "WHERE `users`.`id` = 1"
    end

    let(:hint_type) { :force }

    it { is_expected.to eq sql }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arel-mysql-index-hint-0.1.4 spec/arel-mysql-index-hint/preload_spec.rb
arel-mysql-index-hint-0.1.3 spec/arel-mysql-index-hint/preload_spec.rb
arel-mysql-index-hint-0.1.2 spec/arel-mysql-index-hint/preload_spec.rb