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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/rainforest/cli/remote_tests.rb +12 -6
- data/lib/rainforest/cli/version.rb +1 -1
- data/spec/remote_tests_spec.rb +10 -5
- data/spec/validator_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57df97cd828f99f64c225fac00b833ed53244607
|
4
|
+
data.tar.gz: da04bf47c05996621415d84beddcaef4cf9e5abd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 ||=
|
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 ||=
|
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
|
data/spec/remote_tests_spec.rb
CHANGED
@@ -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) {
|
9
|
-
let(:test2) {
|
10
|
-
let(:test3) {
|
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
|
-
|
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({
|
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
|
data/spec/validator_spec.rb
CHANGED
@@ -34,7 +34,7 @@ describe RainforestCli::Validator do
|
|
34
34
|
subject { described_class.new(options) }
|
35
35
|
|
36
36
|
before do
|
37
|
-
|
37
|
+
allow_any_instance_of(RainforestCli::HttpClient).to receive(:get).and_return([])
|
38
38
|
end
|
39
39
|
|
40
40
|
context 'with parsing errors' do
|