summaryrefslogtreecommitdiff
path: root/spec/hashie/mash_spec.rb
diff options
context:
space:
mode:
authorMichael Herold <michael.j.herold@gmail.com>2018-02-03 10:23:14 -0600
committerMichael Herold <michael.j.herold@gmail.com>2018-06-17 11:04:56 -0500
commit5a6ffc7e2df076c266c322ae9272b098b3ab40ed (patch)
tree578b274928ce6ac710922c85d050771f52753736 /spec/hashie/mash_spec.rb
parent8fc10095fc409f4db495713c92c0cf8e31d3bfc1 (diff)
downloadhashie-5a6ffc7e2df076c266c322ae9272b098b3ab40ed.tar.gz
Update Rubocop and address the addressable todos
This is a big step forward in our Rubocop setup. I addressed all of the todos from the current version of Rubocop that made sense to. The only things that remain are metrics and one cop that relies on the line length metric to work. I made some judgment calls on disabling a few cops: 1. The `Layout/IndentHeredoc` cop wants you to either use the squiggly heredoc from Ruby 2.3 or introduce a library. Since we are a low-level library that is used as a transitive dependency, we cannot introduce another library as a dependence, so that option is out. Also, we support Rubies back to 2.0 currently, so using the squiggly heredoc isn't an option. Once we remove support for Rubies older than 2.3, we can switch to the squiggly heredoc cop. 2. The `Naming/FileName` cop was reporting false positives for a few files in the repository, so I disabled it on those files. 3. The `Style/DoubleNegation` cop reports lints on a few cases where we use double negation. Given the very generic nature of Hashie, the double-negation is the easiest, clearest way to express that we want an item to be a Boolean. I disabled the cop because we exist in the gray area where this makes sense.
Diffstat (limited to 'spec/hashie/mash_spec.rb')
-rw-r--r--spec/hashie/mash_spec.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/spec/hashie/mash_spec.rb b/spec/hashie/mash_spec.rb
index 1a0ad4f..680f403 100644
--- a/spec/hashie/mash_spec.rb
+++ b/spec/hashie/mash_spec.rb
@@ -184,7 +184,8 @@ describe Hashie::Mash do
details: {
email: 'michael@asf.com',
address: 'Nowhere road'
- })
+ }
+ )
end
describe '#deep_update' do
@@ -284,7 +285,7 @@ describe Hashie::Mash do
end
it 'leaves only specified keys' do
- expect(subject.keys.sort).to eq %w(details middle_name)
+ expect(subject.keys.sort).to eq %w[details middle_name]
expect(subject.first_name?).to be_falsy
expect(subject).not_to respond_to(:first_name)
expect(subject.last_name?).to be_falsy
@@ -386,28 +387,28 @@ describe Hashie::Mash do
end
it 'responds to a set key with a suffix' do
- %w(= ? ! _).each do |suffix|
+ %w[= ? ! _].each do |suffix|
expect(subject).to be_respond_to(:"abc#{suffix}")
end
end
it 'is able to access the suffixed key as a method' do
- %w(= ? ! _).each do |suffix|
+ %w[= ? ! _].each do |suffix|
expect(subject.method(:"abc#{suffix}")).to_not be_nil
end
end
it 'responds to an unknown key with a suffix' do
- %w(= ? ! _).each do |suffix|
+ %w[= ? ! _].each do |suffix|
expect(subject).to be_respond_to(:"xyz#{suffix}")
end
end
it 'is able to access an unknown suffixed key as a method' do
# See https://github.com/intridea/hashie/pull/285 for more information
- pending_for(engine: 'ruby', versions: %w(2.2.0 2.2.1 2.2.2))
+ pending_for(engine: 'ruby', versions: %w[2.2.0 2.2.1 2.2.2])
- %w(= ? ! _).each do |suffix|
+ %w[= ? ! _].each do |suffix|
expect(subject.method(:"xyz#{suffix}")).to_not be_nil
end
end
@@ -560,7 +561,7 @@ describe Hashie::Mash do
end
it 'includes all keys' do
- expect(mash.to_hash.keys).to eql(%w(outer testing))
+ expect(mash.to_hash.keys).to eql(%w[outer testing])
end
it 'converts keys to symbols when symbolize_keys option is true' do