Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Rubocop 0.80 #903

Merged
merged 1 commit into from
Feb 18, 2020
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
9 changes: 9 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ Style/AccessModifierDeclarations:
Style/FrozenStringLiteralComment:
EnforcedStyle: always

Style/HashEachMethods:
Enabled: true

Style/HashTransformKeys:
Enabled: true

Style/HashTransformValues:
Enabled: true

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are new lints which Rubocop recommended either explicitly enabling or disabling from .rubocop.yml.

Style/NumericPredicate:
Enabled: false

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ group :development do
# `Gemfile.lock` checked in, so to prevent good builds from suddenly going
# bad, pin to a specific version number here. Try to keep this relatively
# up-to-date, but it's not the end of the world if it's not.
gem "rubocop", "0.79"
gem "rubocop", "0.80"

platforms :mri do
gem "byebug"
Expand Down
10 changes: 5 additions & 5 deletions test/stripe/stripe_object_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,28 +213,28 @@ def to_hash
should "mass assign values with #update_attributes" do
obj = Stripe::StripeObject.construct_from(id: 1, name: "Stripe")

obj.update_attributes({ name: "STRIPE" }) # rubocop:disable Style/BracesAroundHashParameters
obj.update_attributes({ name: "STRIPE" })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


assert_equal "STRIPE", obj.name

# unfortunately, we even assign unknown properties to duplicate the
# behavior that we currently have via magic accessors with
# method_missing
obj.update_attributes({ unknown: "foo" }) # rubocop:disable Style/BracesAroundHashParameters
obj.update_attributes({ unknown: "foo" })

assert_equal "foo", obj.unknown
end

should "#update_attributes with a hash" do
obj = Stripe::StripeObject.construct_from({})
obj.update_attributes({ metadata: { foo: "bar" } }) # rubocop:disable Style/BracesAroundHashParameters
obj.update_attributes({ metadata: { foo: "bar" } })
assert_equal Stripe::StripeObject, obj.metadata.class
end

should "create accessors when #update_attributes is called" do
obj = Stripe::StripeObject.construct_from({})
assert_equal false, obj.send(:metaclass).method_defined?(:foo)
obj.update_attributes({ foo: "bar" }) # rubocop:disable Style/BracesAroundHashParameters
obj.update_attributes({ foo: "bar" })
assert_equal true, obj.send(:metaclass).method_defined?(:foo)
end

Expand Down Expand Up @@ -271,7 +271,7 @@ def to_hash

should "#serialize_params on a basic object" do
obj = Stripe::StripeObject.construct_from(foo: nil)
obj.update_attributes({ foo: "bar" }) # rubocop:disable Style/BracesAroundHashParameters
obj.update_attributes({ foo: "bar" })
assert_equal({ foo: "bar" }, obj.serialize_params)
end

Expand Down