rainforest-cli 1.6.0 → 1.6.1

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: 572509cbd3863f100fbe585b1bef8cd87b1e6660
4
- data.tar.gz: 9d1b997c421aee71f56fe5901d77c245d2291130
3
+ metadata.gz: 57df97cd828f99f64c225fac00b833ed53244607
4
+ data.tar.gz: da04bf47c05996621415d84beddcaef4cf9e5abd
5
5
  SHA512:
6
- metadata.gz: d3dea6785acb946d8882d5a7ef86bc49e0d3a8fbc95580838de499cee1690502e01c647bdcd696567210d4853fcb77e7d611b29e7e69b64390848c9910b2bcba
7
- data.tar.gz: 1fde1d05b2894bc0fca33fe018c38afd8469828f29e31416316e9d21fa1f04f04b217a932e2eb03303f345ac18a1aefff8c613f4b80cbf0d833cd4b9a7680b6e
6
+ metadata.gz: 21c5616ba5d7ff0df5a0614583910c0f7c8bcd4458f3084cf26a5467315210e91df516af11a2398029d5eb46f85d4d87157e3c98f0bc3c48d7946988143e246c
7
+ data.tar.gz: c2296cee1bb950c96fccb48fd8ea261c0b966ff81bc93812a0c9c7427b26467618f952dfe6d110b43db88b40f8eee366e9e090761dcb8b573bb5ada2857ae7fd
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Rainforest CLI Changelog
2
2
 
3
+ ## 1.6.1 - 8th June 2016
4
+ - Use snappier API endpoint for validating RFML ids (e37a4e789eed9b329176ffdb16866aa8902a6cc5, @epaulet).
5
+
3
6
  ## 1.6.0 - 8th June 2016
4
7
  - Add `rm` command to delete tests. (cf077bd440e83852d8d23f66eb72ba94fece0c07, @marktran)
5
8
  - New tests use title given when created using `rainforest new [TEST_NAME]`.
@@ -2,6 +2,7 @@
2
2
  class RainforestCli::RemoteTests
3
3
  def initialize(api_token = nil)
4
4
  Rainforest.api_key = api_token
5
+ @client = RainforestCli::HttpClient.new token: api_token
5
6
  end
6
7
 
7
8
  def api_token_set?
@@ -9,7 +10,7 @@ class RainforestCli::RemoteTests
9
10
  end
10
11
 
11
12
  def rfml_ids
12
- @rfml_ids ||= tests.map(&:rfml_id)
13
+ @rfml_ids ||= primary_key_dictionary.keys
13
14
  end
14
15
 
15
16
  def tests
@@ -36,14 +37,19 @@ class RainforestCli::RemoteTests
36
37
  end
37
38
 
38
39
  def primary_key_dictionary
39
- @primary_key_dictionary ||= {}.tap do |primary_key_dictionary|
40
- tests.each do |rf_test|
41
- primary_key_dictionary[rf_test.rfml_id] = rf_test.id
42
- end
43
- end
40
+ @primary_key_dictionary ||= make_test_dictionary
44
41
  end
45
42
 
46
43
  def logger
47
44
  RainforestCli.logger
48
45
  end
46
+
47
+ def make_test_dictionary
48
+ primary_key_dictionary = {}
49
+ rf_tests = @client.get('/tests/rfml_ids')
50
+ rf_tests.each do |rf_test|
51
+ primary_key_dictionary[rf_test['rfml_id']] = rf_test['id']
52
+ end
53
+ primary_key_dictionary
54
+ end
49
55
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module RainforestCli
3
- VERSION = '1.6.0'
3
+ VERSION = '1.6.1'
4
4
  end
@@ -5,18 +5,23 @@ describe RainforestCli::RemoteTests do
5
5
  describe '#primary_key_dictionary' do
6
6
  Test = Struct.new(:rfml_id, :id)
7
7
 
8
- let(:test1) { Test.new('foo', 123) }
9
- let(:test2) { Test.new('bar', 456) }
10
- let(:test3) { Test.new('baz', 789) }
8
+ let(:test1) { { 'rfml_id' => 'foo', 'id' => 123 } }
9
+ let(:test2) { { 'rfml_id' => 'bar', 'id' => 456 } }
10
+ let(:test3) { { 'rfml_id' => 'baz', 'id' => 789 } }
11
11
  let(:tests) { [test1, test2, test3] }
12
12
 
13
13
  before do
14
- allow(subject).to receive(:tests).and_return(tests)
14
+ allow_any_instance_of(RainforestCli::HttpClient).to receive(:get)
15
+ .with('/tests/rfml_ids').and_return(tests)
15
16
  end
16
17
 
17
18
  it "correctly formats the dictionary's keys and values" do
18
19
  expect(subject.primary_key_dictionary)
19
- .to include({'foo' => test1.id, 'bar' => test2.id, 'baz' => test3.id})
20
+ .to include({
21
+ test1['rfml_id'] => test1['id'],
22
+ test2['rfml_id'] => test2['id'],
23
+ test3['rfml_id'] => test3['id']
24
+ })
20
25
  end
21
26
  end
22
27
  end
@@ -34,7 +34,7 @@ describe RainforestCli::Validator do
34
34
  subject { described_class.new(options) }
35
35
 
36
36
  before do
37
- allow(Rainforest::Test).to receive(:all).and_return([])
37
+ allow_any_instance_of(RainforestCli::HttpClient).to receive(:get).and_return([])
38
38
  end
39
39
 
40
40
  context 'with parsing errors' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rainforest-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Smith