Reflex test to reveal collation sorting varies on different OS...

https://dba.stackexchange.com/questions/106964/why-is-my-postgresql-order-by-case-insensitive

Uncommented, the spec fails on macOS (BSD).. but succeeds in Ubuntu (Linux). Weird.
This commit is contained in:
David Cook
2023-07-26 12:08:37 +10:00
committed by Jean-Baptiste Bellet
parent 0f086df12b
commit 1155bd42ea
2 changed files with 30 additions and 2 deletions

View File

@@ -3,5 +3,33 @@
require "reflex_helper"
describe ProductsReflex, type: :reflex do
let(:current_user) { create(:admin_user) } # todo: set up an enterprise user to test permissions
let(:context) {
{ url: admin_products_v3_index_url, connection: { current_user: } }
}
before do
# activate feature toggle admin_style_v3 to use new admin interface
Flipper.enable(:admin_style_v3)
end
describe 'fetch' do
subject{ build_reflex(method_name: :fetch, **context) }
describe "sorting" do
let!(:product_z) { create(:simple_product, name: "Zucchini") }
# let!(:product_b) { create(:simple_product, name: "bananas") } # Fails on macOS
let!(:product_a) { create(:simple_product, name: "Apples") }
it "Should sort products alphabetically by default" do
subject.run(:fetch)
expect(subject.get(:products).to_a).to eq [
product_a,
# product_b,
product_z,
]
end
end
end
end

View File

@@ -24,7 +24,7 @@ describe 'As an admin, I can see the new product page' do
end
describe "sorting" do
let!(:product_z) { create(:simple_product, name: "Zucchini") }
let!(:product_z) { create(:simple_product, name: "zucchini") }
let!(:product_a) { create(:simple_product, name: "Apples") }
before do
@@ -34,7 +34,7 @@ describe 'As an admin, I can see the new product page' do
it "Should sort products alphabetically by default" do
expect(page).to have_selector "table.products tbody tr td", text: "Apples"
# other products push later one to next page
expect(page).not_to have_selector "table.products tbody tr td", text: "Zucchini"
expect(page).not_to have_selector "table.products tbody tr td", text: "zucchini"
end
end