Sha256: b338651d0cdd29552f47d3e15f33bc39aacd26666f2a1c8d7c8c5cb9d9c9234e
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
require 'rspectacular' require 'chamber/filters/environment_filter' module Chamber module Filters describe EnvironmentFilter do it 'can extract data from the environment if an existing variable matches the ' \ 'composite key' do ENV['TEST_SETTING_GROUP_TEST_SETTING_LEVEL_TEST_SETTING'] = 'value 2' filtered_data = EnvironmentFilter.execute(data: { test_setting_group: { test_setting_level: { test_setting: 'value 1' } } }) test_setting = filtered_data.test_setting_group.test_setting_level.test_setting expect(test_setting).to eql 'value 2' ENV.delete('TEST_SETTING_GROUP_TEST_SETTING_LEVEL_TEST_SETTING') end it 'does not affect items which are not stored in the environment' do ENV['TEST_SETTING_GROUP_TEST_SETTING_LEVEL_TEST_SETTING'] = 'value 2' filtered_data = EnvironmentFilter.execute(data: { test_setting_group: { test_setting_level: { test_setting: 'value 1', another_setting: 'value 3' } } }) another_setting = filtered_data.test_setting_group.test_setting_level.another_setting expect(another_setting).to eql 'value 3' ENV.delete('TEST_SETTING_GROUP_TEST_SETTING_LEVEL_TEST_SETTING') end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chamber-2.8.0 | spec/lib/chamber/filters/environment_filter_spec.rb |
chamber-2.7.1 | spec/lib/chamber/filters/environment_filter_spec.rb |