kumo_keisei 2.1.1 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,13 +1,28 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe KumoKeisei::FileLoader do
4
- describe "#load_config" do
5
- let(:config_dir_path) { '/the/garden/path' }
6
- let(:options) { { config_dir_path: config_dir_path } }
7
- let(:file_name) { 'environment.yml' }
8
- let(:full_file_path) { config_dir_path + '/' + file_name }
4
+ let(:config_dir_path) { '/the/garden/path' }
5
+ let(:options) { { config_dir_path: config_dir_path } }
6
+ let(:file_name) { 'environment.yml' }
7
+ let(:full_file_path) { config_dir_path + '/' + file_name }
8
+
9
+ describe "#load_erb" do
10
+ subject { KumoKeisei::FileLoader.new(options).load_erb(file_name) }
11
+
12
+ context "when the requested erb file exits" do
13
+ let(:fake_erb_object) { double() }
14
+ let(:fake_file_handle) { double() }
15
+
16
+ it "loads the file and returns an ERB object" do
17
+ expect(File).to receive(:read).with("#{config_dir_path}/#{file_name}").and_return(fake_file_handle)
18
+ expect(ERB).to receive(:new).with(fake_file_handle).and_return(fake_erb_object)
19
+ expect(subject).to eq(fake_erb_object)
20
+ end
21
+ end
22
+ end
9
23
 
10
- subject { KumoKeisei::FileLoader.new(options).load_config(file_name) }
24
+ describe "#load_hash" do
25
+ subject { KumoKeisei::FileLoader.new(options).load_hash(file_name) }
11
26
 
12
27
  context "when the file does not exist" do
13
28
  it "returns an empty hash" do
@@ -19,20 +34,19 @@ describe KumoKeisei::FileLoader do
19
34
  let(:file_contents) { 'key: value' }
20
35
 
21
36
  it "populates a hash" do
22
- expect(File).to receive(:exist?).with(full_file_path).and_return(true)
23
37
  expect(File).to receive(:read).with(full_file_path).and_return(file_contents)
24
38
  expect(subject).to eq({ 'key' => 'value' })
25
39
  end
26
40
  end
27
41
  end
28
42
 
29
- describe '#load_config!' do
43
+ describe "#load_hash when you set optional flag to false" do
30
44
  let(:config_dir_path) { '/the/garden/path' }
31
45
  let(:options) { { config_dir_path: config_dir_path } }
32
46
  let(:file_name) { 'environment.yml' }
33
47
  let(:full_file_path) { config_dir_path + '/' + file_name }
34
48
 
35
- subject { KumoKeisei::FileLoader.new(options).load_config!(file_name) }
49
+ subject { KumoKeisei::FileLoader.new(options).load_hash(file_name, false) }
36
50
 
37
51
  context 'when the file does not exist' do
38
52
  it 'raises an error' do
@@ -15,7 +15,7 @@ describe KumoKeisei::ParameterBuilder do
15
15
 
16
16
  describe '#params' do
17
17
  before do
18
- allow(File).to receive(:exists?).with(file_path).and_return(true)
18
+ allow(File).to receive(:exist?).with(file_path).and_return(true)
19
19
  allow(File).to receive(:read).with(file_path).and_return(file_content.to_json)
20
20
  end
21
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumo_keisei
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Redbubble
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-31 00:00:00.000000000 Z
11
+ date: 2016-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -89,6 +89,7 @@ extra_rdoc_files: []
89
89
  files:
90
90
  - ".buildkite/pipeline.yml"
91
91
  - ".gitignore"
92
+ - ".rubocop.yml"
92
93
  - CHANGELOG.md
93
94
  - Gemfile
94
95
  - LICENSE.txt