diff --git a/lib/producer/core/remote/environment.rb b/lib/producer/core/remote/environment.rb index 572924a..40e9ce2 100644 --- a/lib/producer/core/remote/environment.rb +++ b/lib/producer/core/remote/environment.rb @@ -15,7 +15,7 @@ module Producer require 'forwardable' extend Forwardable - def_delegator :@variables, :has_key? + def_delegator :@variables, :key? def initialize(variables) @variables = variables diff --git a/lib/producer/core/tests/has_env.rb b/lib/producer/core/tests/has_env.rb index fbdcc3f..bf18bc6 100644 --- a/lib/producer/core/tests/has_env.rb +++ b/lib/producer/core/tests/has_env.rb @@ -3,7 +3,7 @@ module Producer module Tests class HasEnv < Test def verify - env.remote.environment.has_key? arguments.first.to_s.upcase + env.remote.environment.key? arguments.first.to_s.upcase end end end diff --git a/spec/producer/core/remote/environment_spec.rb b/spec/producer/core/remote/environment_spec.rb index 4337dd4..8eea6de 100644 --- a/spec/producer/core/remote/environment_spec.rb +++ b/spec/producer/core/remote/environment_spec.rb @@ -33,13 +33,13 @@ module Producer::Core end end - describe '#has_key?' do + describe '#key?' do let(:key) { 'SOME_KEY' } it 'forwards the message to @variables' do expect(environment.instance_eval { @variables }) - .to receive(:has_key?).with(key) - environment.has_key? key + .to receive(:key?).with(key) + environment.key? key end end end diff --git a/spec/producer/core/tests/has_env_spec.rb b/spec/producer/core/tests/has_env_spec.rb index dec0329..58ff1e0 100644 --- a/spec/producer/core/tests/has_env_spec.rb +++ b/spec/producer/core/tests/has_env_spec.rb @@ -18,22 +18,22 @@ module Producer::Core end it 'stringifies the queried variable name' do - expect(environment).to receive(:has_key?).with(kind_of(String)) + expect(environment).to receive(:key?).with(kind_of(String)) has_env.verify end it 'upcases the queried variable name' do - expect(environment).to receive(:has_key?).with('SOME_VARIABLE_NAME') + expect(environment).to receive(:key?).with('SOME_VARIABLE_NAME') has_env.verify end it 'returns true when remote environment var is defined' do - allow(environment).to receive(:has_key?) { true } + allow(environment).to receive(:key?) { true } expect(has_env.verify).to be true end it 'returns false when remote environment var is not defined' do - allow(environment).to receive(:has_key?) { false } + allow(environment).to receive(:key?) { false } expect(has_env.verify).to be false end end