test_flight_client 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b16d2a0329290ce154594f7fbd712ac9ce0a3059
4
- data.tar.gz: 6ed91cf82179b4a0330ea3e699673f2c1d0d4e2c
3
+ metadata.gz: 57e11f05c6a373adde72b35a1d45bbeadf3f5793
4
+ data.tar.gz: ac7d18298e3c90410a65ef3808cd4729e08b7b36
5
5
  SHA512:
6
- metadata.gz: 80513d9275a241bc22bfaa018274936ab88f87deebbdff4ed83d77c1c08695ec2d2e31a6c3396c8248011bb5ac9c6e534e29fed9736b978674daf9f3f35b7017
7
- data.tar.gz: fbf0481a618a0ae2eb21f8aa5ffd92c20c9c379d766875da3bba6e3117eb504e91538eac91c8b02e75e2811454455db76c6f0dc987106b109a579375bbe3bb14
6
+ metadata.gz: a06f8ad47a7f681b2f56c05b67205154610d7ae683935d49e6fc0cfd0c97f0b9a10ebff2bf4fe41611f7ba735e007a0a560b9abdad55503e68895ae431367949
7
+ data.tar.gz: 61525ac7088c1c75659537be9bb3851327fa8c64df091a940455473c84a800014247d846d077ec12b6357589e301defbb1312ccbd593f388d68e3642873135ec
data/README.md CHANGED
@@ -26,6 +26,10 @@ Or install it yourself as:
26
26
  file: 'file path or file object',
27
27
  notes: 'whatever notes you want to add'
28
28
  )
29
+
30
+ # if you are using bundler then any parameters found in file
31
+ # config/test_flight.yml will be used but overridden by what
32
+ # is sent through manually to #build as parameter
29
33
 
30
34
  ## Contributing
31
35
 
@@ -4,7 +4,30 @@ require 'test_flight_client/api_request'
4
4
  module TestFlightClient
5
5
 
6
6
  def self.build(params = {})
7
- ApiRequest.new.post('/builds', params)
7
+ ApiRequest.new.post('/builds', merged_parameters(params))
8
+ end
9
+
10
+ private
11
+
12
+ def self.merged_parameters(params)
13
+ config_params.merge(params)
14
+ end
15
+
16
+ def self.config_params
17
+ if config_file && File.exists?(config_file)
18
+ YAML::load(ERB.new(File.read(config_file)).result)
19
+ else
20
+ {}
21
+ end
22
+ end
23
+
24
+ def self.config_file
25
+ if ENV['BUNDLE_GEMFILE']
26
+ application_root = ENV['BUNDLE_GEMFILE'].gsub('Gemfile', '')
27
+ File.expand_path(File.join(application_root, 'config', 'test_flight.yml'), __FILE__)
28
+ else
29
+ false
30
+ end
8
31
  end
9
32
 
10
33
  end
@@ -1,3 +1,3 @@
1
1
  module TestFlightClient
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -17,12 +17,34 @@ describe TestFlightClient do
17
17
 
18
18
  context 'when given parameters' do
19
19
 
20
- let(:params) { double('params') }
20
+ let(:params) { {one: 'ONE', two: 'TWO'} }
21
21
 
22
22
  it 'posts an API request passing through given parameters' do
23
23
  expect(api_request).to receive(:post).with anything, params
24
24
  subject.build params
25
25
  end
26
+
27
+ context 'when a config file is available' do
28
+
29
+ let(:config_file) { double('config file') }
30
+ let(:gemfile_path) { 'path/to/Gemfile' }
31
+ let(:config_double) { double('config') }
32
+ let(:erb_double) { double('erb', :result => config_file) }
33
+ let(:config_file_params) { {one: '1', two: '2', three: '3'} }
34
+
35
+ before do
36
+ ENV.stub(:[]).with('BUNDLE_GEMFILE').and_return gemfile_path
37
+ File.stub(:exists?).and_return true
38
+ File.stub(:read).and_return config_double
39
+ ERB.stub(:new).with(config_double).and_return erb_double
40
+ YAML.stub(:load).with(config_file).and_return config_file_params
41
+ end
42
+
43
+ it 'merges in any parameters found in the config file that dont already exist' do
44
+ expect(api_request).to receive(:post).with(anything, {one: 'ONE', two: 'TWO', three: '3'})
45
+ subject.build params
46
+ end
47
+ end
26
48
  end
27
49
  end
28
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_flight_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seb Glazebrook
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-21 00:00:00.000000000 Z
11
+ date: 2014-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httmultiparty