diff options
-rw-r--r-- | .rubocop_todo.yml | 8 | ||||
-rw-r--r-- | spec/hashie/hash_spec.rb | 12 |
2 files changed, 13 insertions, 7 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 859b591..befd2ab 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -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. diff --git a/spec/hashie/hash_spec.rb b/spec/hashie/hash_spec.rb index fa1c878..bcfc6c7 100644 --- a/spec/hashie/hash_spec.rb +++ b/spec/hashie/hash_spec.rb @@ -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 |