Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Use a portable boolean literal in the returns migration spec

Damian Legawiec33fe288f79b2
diff --git a/spree/core/spec/lib/tasks/migrate_returns_spec.rb b/spree/core/spec/lib/tasks/migrate_returns_spec.rb
index 67b71d8b01..4d8e0bb31d 100644
--- a/spree/core/spec/lib/tasks/migrate_returns_spec.rb
+++ b/spree/core/spec/lib/tasks/migrate_returns_spec.rb
@@ -23,6 +23,11 @@ RSpec.describe Spree::ReturnsMigrator do
SQL
end
+ # SQLite takes 1/0 for booleans, PostgreSQL does not — ask the adapter.
+ def quoted_true
+ ActiveRecord::Base.connection.quoted_true
+ end
+
def insert_item(authorization_id, exchange_variant_id: nil, reception_status: 'awaiting',
reimbursement_id: nil, pre_tax_amount: 10.0)
ActiveRecord::Base.connection.insert(<<~SQL.squish)
@@ -32,7 +37,7 @@ RSpec.describe Spree::ReturnsMigrator do
VALUES
(#{authorization_id}, #{fulfillment_item.id},
#{exchange_variant_id || 'NULL'}, '#{reception_status}',
- #{reimbursement_id || 'NULL'}, #{pre_tax_amount}, 1,
+ #{reimbursement_id || 'NULL'}, #{pre_tax_amount}, #{quoted_true},
'#{1.day.ago.to_fs(:db)}', '#{1.day.ago.to_fs(:db)}')
SQL
end