Fix Style/ParallelAssignment

This commit is contained in:
Jared Beck 2016-03-05 17:23:10 -05:00
parent c7fe611907
commit 4200a6a8ca
3 changed files with 8 additions and 11 deletions

View File

@ -194,13 +194,6 @@ Style/Not:
Style/NumericLiterals:
MinDigits: 15
# Offense count: 4
# Cop supports --auto-correct.
Style/ParallelAssignment:
Exclude:
- 'spec/models/gadget_spec.rb'
- 'test/test_helper.rb'
# Offense count: 3
# Cop supports --auto-correct.
Style/RescueModifier:

View File

@ -51,12 +51,14 @@ describe Gadget, type: :model do
context "with update timestamps" do
it "should only acknowledge non-ignored attrs" do
subject.name, subject.updated_at = "Wrench", Time.now
subject.name = "Wrench"
subject.updated_at = Time.now
expect(subject.send(:changed_notably?)).to be true
end
it "should not acknowledge ignored attrs and timestamps only" do
subject.brand, subject.updated_at = "Acme", Time.now
subject.brand = "Acme"
subject.updated_at = Time.now
expect(subject.send(:changed_notably?)).to be false
end
end

View File

@ -58,7 +58,8 @@ module ActiveSupport
def assert_attributes_equal(expected, actual)
if using_mysql?
expected, actual = expected.dup, actual.dup
expected = expected.dup
actual = actual.dup
# Adjust timestamps for missing fractional seconds precision.
%w(created_at updated_at).each do |timestamp|
@ -72,7 +73,8 @@ module ActiveSupport
def assert_changes_equal(expected, actual)
if using_mysql?
expected, actual = expected.dup, actual.dup
expected = expected.dup
actual = actual.dup
# Adjust timestamps for missing fractional seconds precision.
%w(created_at updated_at).each do |timestamp|