Sha256: 792c82e114ba0718e3ed73264a9bccd233e6b5a9246c1ad818519650309ee194
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true RSpec.describe "model_indexes_shelves" do it "randomly selects from shelves" do expect(Shelf.all.to_sql).to end_with("ORDER BY RANDOM()") end it "randomly selects from some shelves" do expect(Shelf.where(contents: "foo").to_sql).to end_with("ORDER BY RANDOM()") end it "randomly selects from shelves ordered by id" do expect(Shelf.order(:shelf_id).to_sql).to end_with('ORDER BY "shelves"."shelf_id" ASC, RANDOM()') end it "randomly selects from shelves ordered by position" do expect(Shelf.order(:shelf_position).to_sql).to end_with( 'ORDER BY "shelves"."shelf_position" ASC, RANDOM()' ) end it "nonrandomly selects from shelves ordered by id and position" do expect(Shelf.order(:shelf_id, :shelf_position).to_sql).to end_with( 'ORDER BY "shelves"."shelf_id" ASC, "shelves"."shelf_position" ASC' ) end it "nonrandomly selects from some shelves ordered by id and position" do expect(Shelf.where(contents: "bar").order(:shelf_id, :shelf_position).to_sql).to end_with( 'ORDER BY "shelves"."shelf_id" ASC, "shelves"."shelf_position" ASC' ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
unreliable-0.9.1 | spec/model_indexes_shelves_spec.rb |
unreliable-0.9.0 | spec/model_indexes_shelves_spec.rb |