From b8e1400c755401e87952656fdf1b938ba8f8cc82 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Wed, 20 Dec 2017 16:49:14 -0800 Subject: [PATCH 1/3] Fix MySQL timestamp issues in classification_spec --- core/spec/models/spree/classification_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/spec/models/spree/classification_spec.rb b/core/spec/models/spree/classification_spec.rb index a0168ca017b..50da3799adf 100644 --- a/core/spec/models/spree/classification_spec.rb +++ b/core/spec/models/spree/classification_spec.rb @@ -94,6 +94,7 @@ def positions_to_be_valid(taxon) taxon = taxon_with_5_products classification = taxon.classifications.first product = classification.product + product.update_columns(updated_at: 1.day.ago) expect { classification.touch }.to change { product.reload.updated_at } @@ -102,6 +103,7 @@ def positions_to_be_valid(taxon) it "touches the taxon" do taxon = taxon_with_5_products classification = taxon.classifications.first + taxon.update_columns(updated_at: 1.day.ago) expect { classification.touch }.to change { taxon.reload.updated_at } From da5f398fe5ab8436eb588105ae9a9c19a89f7833 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Wed, 20 Dec 2017 17:01:21 -0800 Subject: [PATCH 2/3] Fix broken stock items unique index under MySQL The "where" clause of this unique index doesn't work under MySQL, which indexes the whole table. Previously it was wrapped in an if condition. This was broken as part of the roll-up migration. --- core/db/migrate/20160101010000_solidus_one_four.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/db/migrate/20160101010000_solidus_one_four.rb b/core/db/migrate/20160101010000_solidus_one_four.rb index ba001422efd..2c0cb276270 100644 --- a/core/db/migrate/20160101010000_solidus_one_four.rb +++ b/core/db/migrate/20160101010000_solidus_one_four.rb @@ -817,7 +817,10 @@ def up t.index ["deleted_at"], name: "index_spree_stock_items_on_deleted_at" t.index ["stock_location_id", "variant_id"], name: "stock_item_by_loc_and_var_id" t.index ["stock_location_id"], name: "index_spree_stock_items_on_stock_location_id" - t.index ["variant_id", "stock_location_id"], name: "index_spree_stock_items_on_variant_id_and_stock_location_id", unique: true, where: "deleted_at is null" + + if connection.supports_partial_index? + t.index ["variant_id", "stock_location_id"], name: "index_spree_stock_items_on_variant_id_and_stock_location_id", unique: true, where: "deleted_at is null" + end end create_table "spree_stock_locations", force: :cascade do |t| From dbbfd21f4e6d9faf8efca682b9e9b4bafdb8b6b3 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Thu, 21 Dec 2017 11:36:52 -0800 Subject: [PATCH 3/3] Fix admin/users_spec failure under MySQL --- backend/spec/features/admin/users_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/spec/features/admin/users_spec.rb b/backend/spec/features/admin/users_spec.rb index 0b5315f4b65..7a0f13d3104 100644 --- a/backend/spec/features/admin/users_spec.rb +++ b/backend/spec/features/admin/users_spec.rb @@ -99,6 +99,10 @@ end context "member since" do + before do + user_a.update_column(:created_at, 2.weeks.ago) + end + it_behaves_like "a sortable attribute" do let(:text_match_1) { user_a.email } let(:text_match_2) { user_b.email } @@ -107,7 +111,6 @@ end it 'displays the correct results for a user search by creation date' do - user_a.update_column(:created_at, 2.weeks.ago) fill_in 'q_created_at_lt', with: 1.week.ago click_button 'Search' within_table('listing_users') do