From 50540e301e2771231fca594fb855171dc58a9a82 Mon Sep 17 00:00:00 2001 From: Nick Carboni Date: Thu, 23 Mar 2017 17:01:49 -0400 Subject: [PATCH] Add count to the reserved names list --- lib/config/options.rb | 2 +- spec/fixtures/reserved_keywords.yml | 1 + spec/options_spec.rb | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/config/options.rb b/lib/config/options.rb index 0c3e9e32..92e8c2b0 100644 --- a/lib/config/options.rb +++ b/lib/config/options.rb @@ -131,7 +131,7 @@ def merge!(hash) end # Some keywords that don't play nicely with OpenStruct - SETTINGS_RESERVED_NAMES = %w{select collect test} + SETTINGS_RESERVED_NAMES = %w{select collect test count} # An alternative mechanism for property access. # This let's you do foo['bar'] along with foo.bar. diff --git a/spec/fixtures/reserved_keywords.yml b/spec/fixtures/reserved_keywords.yml index c00d4b1a..0ac0c37d 100644 --- a/spec/fixtures/reserved_keywords.yml +++ b/spec/fixtures/reserved_keywords.yml @@ -1,2 +1,3 @@ select: 123 collect: 456 +count: 789 diff --git a/spec/options_spec.rb b/spec/options_spec.rb index 86cf6f94..4ac1ea99 100644 --- a/spec/options_spec.rb +++ b/spec/options_spec.rb @@ -10,14 +10,17 @@ it 'should allow to access them via object member notation' do expect(config.select).to eq(123) expect(config.collect).to eq(456) + expect(config.count).to eq(789) end it 'should allow to access them using [] operator' do expect(config['select']).to eq(123) expect(config['collect']).to eq(456) + expect(config['count']).to eq(789) expect(config[:select]).to eq(123) expect(config[:collect]).to eq(456) + expect(config[:count]).to eq(789) end end