Skip to content

Commit

Permalink
Fix Ruby 2.7
Browse files Browse the repository at this point in the history
Fix rubocop
  • Loading branch information
ericproulx committed Dec 15, 2024
1 parent 710aa2e commit bda6e59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 3 additions & 4 deletions lib/grape/exceptions/validation_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ def full_messages
each do |attributes, error|
messages <<
I18n.t(ERRORS_FORMAT_KEY,
default: DEFAULT_ERRORS_FORMAT,
attributes: translate_attributes(attributes),
message: error.message
)
default: DEFAULT_ERRORS_FORMAT,
attributes: translate_attributes(attributes),
message: error.message)
end
messages.uniq!
end
Expand Down
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
end
end

Grape::Util::Registry.include(Deregister)
# issue with ruby 2.7 with ^. We need to extend it again
Grape::Validations.extend(Grape::Util::Registry) if Gem::Version.new(RUBY_VERSION).release < Gem::Version.new('3.0')

# The default value for this setting is true in a standard Rails app,
# so it should be set to true here as well to reflect that.
I18n.enforce_available_locales = true
Grape::Util::Registry.prepend(Deregister)

RSpec.configure do |config|
config.include Rack::Test::Methods
Expand Down

0 comments on commit bda6e59

Please sign in to comment.