spec/model_select_spec.rb in unreliable-0.9.1 vs spec/model_select_spec.rb in unreliable-0.10.0
- old
+ new
@@ -1,22 +1,22 @@
# frozen_string_literal: true
RSpec.describe Cat do
it "randomly selects from all" do
- expect(Cat.all.to_sql).to end_with("ORDER BY RANDOM()")
+ expect(Cat.all.to_sql).to end_with(adapter_text("ORDER BY RANDOM()"))
end
it "randomly selects from some" do
- expect(Cat.where(name: "foo").to_sql).to end_with("ORDER BY RANDOM()")
+ expect(Cat.where(name: "foo").to_sql).to end_with(adapter_text("ORDER BY RANDOM()"))
end
it "adds randomness to existing order" do
- expect(Cat.order(:name).to_sql).to end_with('ORDER BY "cats"."name" ASC, RANDOM()')
+ expect(Cat.order(:name).to_sql).to end_with(adapter_text('ORDER BY "cats"."name" ASC, RANDOM()'))
end
it "respects a disable block" do
Unreliable::Config.disable do
- expect(Cat.where(name: "foo").to_sql).to_not end_with("ORDER BY RANDOM()")
- expect(Cat.where(name: "foo").to_sql).to end_with(%q("cats"."name" = 'foo'))
+ expect(Cat.where(name: "foo").to_sql).to_not end_with(adapter_text("ORDER BY RANDOM()"))
+ expect(Cat.where(name: "foo").to_sql).to end_with(adapter_text(%q("cats"."name" = 'foo')))
end
end
end