Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions api/spec/requests/spree/api/checkouts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
}
end

it "can update addresses and transition from address to delivery" do

Check warning on line 87 in api/spec/requests/spree/api/checkouts_spec.rb

View workflow job for this annotation

GitHub Actions / solidus_api / Rails 8.0, Ruby 3.4, sqlite, activestorage

Checkouts PUT 'update' transitioning to delivery can update addresses and transition from address to delivery Skipped: SQLite adapter fails sometimes to provide a unique index for the convoluted chain of ActiveRecord persistence calls that happen on https://github.com/solidusio/solidus/blob/8b03161a1894a7d10c8d95f62c016da55027d2b0/core/app/models/spree/stock/simple_coordinator.rb#L83
skip <<~MSG if ActiveRecord::Base.connection.adapter_name == "SQLite"
SQLite adapter fails sometimes to provide a unique index for the convoluted chain
of ActiveRecord persistence calls that happen on
Expand Down Expand Up @@ -117,12 +117,12 @@
bill_address_attributes: address,
ship_address_attributes: address
}}
expect(json_response["error"]).to eq(I18n.t(:could_not_transition, scope: "spree.api", resource: "order"))
expect(json_response["error"]).to eq("The order could not be transitioned. Please fix the errors and try again.")
expect(response.status).to eq(422)
end

# Regression test for https://github.com/spree/spree/issues/4498
it "does not contain duplicate variant data in delivery return" do

Check warning on line 125 in api/spec/requests/spree/api/checkouts_spec.rb

View workflow job for this annotation

GitHub Actions / solidus_api / Rails 8.0, Ruby 3.4, sqlite, activestorage

Checkouts PUT 'update' transitioning to delivery does not contain duplicate variant data in delivery return Skipped: SQLite adapter fails sometimes to provide a unique index for the convoluted chain of ActiveRecord persistence calls that happen on https://github.com/solidusio/solidus/blob/8b03161a1894a7d10c8d95f62c016da55027d2b0/core/app/models/spree/stock/simple_coordinator.rb#L83
skip <<~MSG if ActiveRecord::Base.connection.adapter_name == "SQLite"
SQLite adapter fails sometimes to provide a unique index for the convoluted chain
of ActiveRecord persistence calls that happen on
Expand Down Expand Up @@ -497,7 +497,7 @@
order.update_column(:email, "solidus@example.com")
put spree.next_api_checkout_path(order), params: {order_token: order.guest_token}
expect(response.status).to eq(422)
expect(json_response["errors"]["base"]).to include(I18n.t("spree.there_are_no_items_for_this_order"))
expect(json_response["errors"]["base"]).to include("There are no items for this order. Please add an item to the order to continue.")
end

it "can transition an order to the next state" do
Expand Down Expand Up @@ -541,7 +541,7 @@

it "returns a sensible error when no payment method is specified" do
subject
expect(json_response["errors"]["base"]).to include(I18n.t("spree.no_payment_found"))
expect(json_response["errors"]["base"]).to include("No payment found")
end

context "with mismatched expected_total" do
Expand All @@ -550,7 +550,7 @@
it "returns an error if expected_total is present and does not match actual total" do
subject
expect(response.status).to eq(400)
expect(json_response["errors"]["expected_total"]).to include(I18n.t("spree.api.order.expected_total_mismatch"))
expect(json_response["errors"]["expected_total"]).to include("Expected total does not match actual total.")
end
end

Expand All @@ -562,7 +562,7 @@
it "returns a state machine error" do
subject

expect(json_response["error"]).to eq(I18n.t(:could_not_transition, scope: "spree.api", resource: "order"))
expect(json_response["error"]).to eq("The order could not be transitioned. Please fix the errors and try again.")
expect(response.status).to eq(422)
end
end
Expand Down
6 changes: 3 additions & 3 deletions api/spec/requests/spree/api/coupon_codes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module Spree::Api
expect(response.status).to eq(422)
expect(json_response).to eq({
"success" => nil,
"error" => I18n.t("spree.coupon_code_unknown_error"),
"error" => "This coupon code could not be applied to the cart at this time.",
"successful" => false,
"status_code" => "coupon_code_unknown_error"
})
Expand Down Expand Up @@ -105,7 +105,7 @@ module Spree::Api
subject
expect(response.status).to eq(200)
expect(json_response).to eq({
"success" => I18n.t("spree.coupon_code_removed"),
"success" => "The coupon code was successfully removed from this order.",
"error" => nil,
"successful" => true,
"status_code" => "coupon_code_removed"
Expand Down Expand Up @@ -134,7 +134,7 @@ module Spree::Api
expect(response.status).to eq(422)
expect(json_response).to eq({
"success" => nil,
"error" => I18n.t("spree.coupon_code_not_present"),
"error" => "The coupon code you are trying to remove is not present on this order.",
"successful" => false,
"status_code" => "coupon_code_not_present"
})
Expand Down
6 changes: 3 additions & 3 deletions api/spec/requests/spree/api/images_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,20 @@ module Spree::Api
it "cannot get an image of another product" do
get spree.api_product_image_path(product.id, product_image)
expect(response.status).to eq(404)
expect(json_response["error"]).to eq(I18n.t(:resource_not_found, scope: "spree.api"))
expect(json_response["error"]).to eq("The resource you were looking for could not be found.")
end

it "cannot get an image of another variant" do
get spree.api_variant_image_path(product.master.id, product_image)
expect(response.status).to eq(404)
expect(json_response["error"]).to eq(I18n.t(:resource_not_found, scope: "spree.api"))
expect(json_response["error"]).to eq("The resource you were looking for could not be found.")
end

it "cannot update image of another product" do
expect(product_image.position).to eq(1)
put spree.api_variant_image_path(product.master.id, product_image), params: {image: {position: 2}}
expect(response.status).to eq(404)
expect(json_response["error"]).to eq(I18n.t(:resource_not_found, scope: "spree.api"))
expect(json_response["error"]).to eq("The resource you were looking for could not be found.")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion api/spec/requests/spree/api/orders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1044,7 +1044,7 @@ module Spree::Api
it "cannot cancel not completed order" do
put spree.cancel_api_order_path(order)

expect(json_response["error"]).to eq(I18n.t(:could_not_transition, scope: "spree.api", resource: "order"))
expect(json_response["error"]).to eq("The order could not be transitioned. Please fix the errors and try again.")
expect(response.status).to eq(422)
end

Expand Down
6 changes: 3 additions & 3 deletions api/spec/requests/spree/api/stock_items_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ module Spree::Api
it "does not allow negative inventory for the stock item" do
subject
expect(response.status).to eq 422
expect(response.body).to match I18n.t("spree.api.stock_not_below_zero")
expect(json_response["error"]).to eq("Stock must not be below zero.")
expect(assigns(:stock_item).count_on_hand).to eq 0
end
end
Expand Down Expand Up @@ -236,7 +236,7 @@ module Spree::Api
it "does not allow negative inventory for the stock item" do
subject
expect(response.status).to eq 422
expect(response.body).to match I18n.t("spree.api.stock_not_below_zero")
expect(json_response["error"]).to eq("Stock must not be below zero.")
expect(assigns(:stock_item).count_on_hand).to eq 10
end
end
Expand Down Expand Up @@ -294,7 +294,7 @@ module Spree::Api
it "does not allow negative inventory for the stock item" do
subject
expect(response.status).to eq 422
expect(response.body).to match I18n.t("spree.api.stock_not_below_zero")
expect(json_response["error"]).to eq("Stock must not be below zero.")
expect(assigns(:stock_item).count_on_hand).to eq 10
end
end
Expand Down
Loading