Sha256: be8802f28f104c70df54c8aff2df2157e8a5e5532a69dfa97ea52fa8051e7e56
Contents?: true
Size: 1.58 KB
Versions: 21
Compression:
Stored size: 1.58 KB
Contents
require 'spec_helper' describe KumoKeisei::ParameterBuilder do subject {described_class.new(dynamic_params, file_path) } let(:dynamic_params) { {} } let(:file_path) { nil } let(:file_content) do [ { "ParameterKey" => "testFileKey", "ParameterValue" => "testFileValue", }, ] end describe '#params' do before do allow(File).to receive(:exist?).with(file_path).and_return(true) allow(File).to receive(:read).with(file_path).and_return(file_content.to_json) end context "when there are dynamic params" do let(:dynamic_params) { { key: 'value', other_key: 'other_value' } } it 'includes command line params' do expect(subject.params).to eq([{ parameter_key: 'key', parameter_value: 'value' }, { parameter_key: 'other_key', parameter_value: 'other_value'}]) end end context "when there are file params" do let(:file_path) { '/some/path/to/params.json' } it 'includes an input file' do expect(subject.params).to eq([{ parameter_key: 'testFileKey', parameter_value: 'testFileValue' }]) end end context "there are both" do let(:dynamic_params) { { key: 'value', other_key: 'other_value' } } let(:file_path) { '/some/path/to/params.json' } it 'includes command line params' do expect(subject.params).to eq([ { parameter_key: 'key', parameter_value: 'value' }, { parameter_key: 'other_key', parameter_value: 'other_value'}, { parameter_key: 'testFileKey', parameter_value: 'testFileValue' } ]) end end end end
Version data entries
21 entries across 21 versions & 1 rubygems