Sha256: 31cea6ff3c93994a4cb3c5a1a16d6520bb3d7dfb318ca3ac506971a69158443b

Contents?: true

Size: 532 Bytes

Versions: 2

Compression:

Stored size: 532 Bytes

Contents

# frozen_string_literal: true

RSpec.describe "model_indexes_books" do
  it "randomly selects from books with no order" do
    expect(Book.all.to_sql).to end_with("ORDER BY RANDOM()")
  end

  it "randomly selects from books ordered by nonindexed column" do
    expect(Book.all.order(:subject).to_sql).to end_with('ORDER BY "books"."subject" ASC, RANDOM()')
  end

  it "randomly selects from books ordered by unique column" do
    expect(Book.all.order(:isbn).to_sql).to end_with('ORDER BY "books"."isbn" ASC, RANDOM()')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
unreliable-0.9.1 spec/model_indexes_books_spec.rb
unreliable-0.9.0 spec/model_indexes_books_spec.rb