Fix: broken cop, for now disabling hash syntax check.

This commit is contained in:
dblock 2015-10-25 15:28:56 -04:00
parent acc3d48b91
commit 9298241eb2
2 changed files with 13 additions and 7 deletions

View File

@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2015-10-25 15:12:09 -0400 using RuboCop version 0.34.2.
# on 2015-10-25 15:28:03 -0400 using RuboCop version 0.34.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@ -57,6 +57,12 @@ Style/DoubleNegation:
- 'lib/hashie/mash.rb'
- 'spec/hashie/extensions/coercion_spec.rb'
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
Style/HashSyntax:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes.

View File

@ -8,21 +8,21 @@ describe Hash do
end
it '#stringify_keys! turns all keys into strings' do
hash = Hashie::Hash[:a => 'hey', 123 => 'bob']
hash = Hashie::Hash[a: 'hey', 123 => 'bob']
hash.stringify_keys!
expect(hash).to eq Hashie::Hash['a' => 'hey', '123' => 'bob']
end
it '#stringify_keys! turns all keys into strings recursively' do
hash = Hashie::Hash[:a => 'hey', 123 => { 345 => 'hey' }]
hash = Hashie::Hash[a: 'hey', 123 => { 345 => 'hey' }]
hash.stringify_keys!
expect(hash).to eq Hashie::Hash['a' => 'hey', '123' => { '345' => 'hey' }]
end
it '#stringify_keys returns a hash with stringified keys' do
hash = Hashie::Hash[:a => 'hey', 123 => 'bob']
hash = Hashie::Hash[a: 'hey', 123 => 'bob']
stringified_hash = hash.stringify_keys
expect(hash).to eq Hashie::Hash[:a => 'hey', 123 => 'bob']
expect(hash).to eq Hashie::Hash[a: 'hey', 123 => 'bob']
expect(stringified_hash).to eq Hashie::Hash['a' => 'hey', '123' => 'bob']
end
@ -41,7 +41,7 @@ describe Hash do
it '#to_hash with symbolize_keys set to true returns a hash with symbolized keys' do
hash = Hashie::Hash['a' => 'hey', 123 => 'bob', 'array' => [1, 2, 3]]
symbolized_hash = hash.to_hash(symbolize_keys: true)
expect(symbolized_hash).to eq(:a => 'hey', :"123" => 'bob', :array => [1, 2, 3])
expect(symbolized_hash).to eq(a: 'hey', :"123" => 'bob', array: [1, 2, 3])
end
it "#to_hash should not blow up when #to_hash doesn't accept arguments" do
@ -78,7 +78,7 @@ describe Hash do
it '#to_hash with symbolize_keys set to true returns a hash with symbolized keys' do
hash = Hashie::Hash['a' => 'hey', 123 => 'bob', 'array' => [1, 2, 3], subhash: ClassRespondsToHash.new]
symbolized_hash = hash.to_hash(symbolize_keys: true)
expect(symbolized_hash).to eq(:a => 'hey', :"123" => 'bob', :array => [1, 2, 3], subhash: { :a => 'hey', :b => 'bar', :'123' => 'bob', :array => [1, 2, 3] })
expect(symbolized_hash).to eq(a: 'hey', :"123" => 'bob', array: [1, 2, 3], subhash: { a: 'hey', b: 'bar', :'123' => 'bob', array: [1, 2, 3] })
end
end
end