Skip to content

Commit

Permalink
Support Ruby 3
Browse files Browse the repository at this point in the history
Besides a couple of [issues related to the new separation between
keyword and positional
arguments](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/),
this bug rails/rails#42098 is currently
hitting us. As we don't need to do anything from our side, we mark our
failing example so that we'll notice when it gets fixed upstream.
  • Loading branch information
waiting-for-dev committed May 20, 2021
1 parent 6d5440f commit 31f0b63
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/app/models/spree/return_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ def validate_no_other_completed_return_items
}).where.not(id: id).first

if other_return_item && (new_record? || COMPLETED_RECEPTION_STATUSES.include?(reception_status.to_sym))
errors.add(:inventory_unit, :other_completed_return_item_exists, {
errors.add(:inventory_unit, :other_completed_return_item_exists,
inventory_unit_id: inventory_unit_id,
return_item_id: other_return_item.id
})
)
end
end

Expand Down
2 changes: 1 addition & 1 deletion core/lib/spree/core/validators/email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class EmailValidator < ActiveModel::EachValidator

def validate_each(record, attribute, value)
unless EMAIL_REGEXP.match? value
record.errors.add(attribute, :invalid, { value: value }.merge!(options))
record.errors.add(attribute, :invalid, **{ value: value }.merge!(options))
end
end
end
Expand Down
8 changes: 7 additions & 1 deletion core/spec/models/spree/store_credit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,13 @@

subject { store_credit.validate_authorization(store_credit_attrs[:amount], store_credit.currency) }

it { is_expected.to be_truthy }
if RUBY_VERSION >= "3"
pending "https://github.com/rails/rails/issues/42098" do
it { is_expected.to be_truthy }
end
else
it { is_expected.to be_truthy }
end
end
end

Expand Down

0 comments on commit 31f0b63

Please sign in to comment.