rainforest-cli 1.10.3 → 1.10.4

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: 404d70dc620de15e7e6eeb220d60a1809f722ee1
4
- data.tar.gz: 9a23f6f532cb6cf9eaf6139868a876d020453392
3
+ metadata.gz: 192f7e0575ed3b8e2a790d514816f81a2cd98dfb
4
+ data.tar.gz: 11f021face63574272a30382144def1a06f7355f
5
5
  SHA512:
6
- metadata.gz: 34ce70554f9807d0e2db16dd7c6eb58f5a219da7198b3c4db64dfa97ebd745585303ceac5c6f4bf501e45c2eb1bc0274fc023d73bd0642f35216ca65f5c3e38b
7
- data.tar.gz: 10b6f5678629a9b9516ca2e6837e04569ffb79b61a35c97e2602073fff16f4f83372fb37debb9b3b82b30182846041ff88d27c1e2b184f7409409bc4424aee68
6
+ metadata.gz: b46770a727a8614482a68fe966a628ed814835c3b1c852658251d6d28b23597824ae2a1047bd2120e7bedb07338cfce45d906568830a15af54ef5c3c8873f488
7
+ data.tar.gz: 2f0628e2fdeca4061782b02016f59abceb81d6c69ae4f6632994b5ab13a7d87e1e4a8db66aef33ce817b2ccb581dedd3a647b624a8347279cadc2e16ed13cd6b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Rainforest CLI Changelog
2
2
 
3
+ ## 1.10.4 - 31st October 2016
4
+ - Do not upload test metadata as test description. (1c8b46d2156da17be939ac67edefe2bd2b56af47, @epaulet)
5
+
3
6
  ## 1.10.3 - 21st October 2016
4
7
  - Fix bug with accidental removal of 3 commands. (d9ebbd702ba1b1b64b9a1a222c301315b89d743e, @curtis-rainforestqa)
5
8
  - Add better tolerance for server errors. (b4180332ca13fec0972c3d65dbce00242907ca38, @epaulet)
@@ -26,8 +26,7 @@ module RainforestCli::TestParser
26
26
  @test.browsers = []
27
27
  end
28
28
 
29
- TEST_DATA_FIELDS = [:start_uri, :title, :site_id, :browsers].freeze
30
- STEP_DATA_FIELDS = [:redirect].freeze
29
+ TEST_DATA_FIELDS = [:start_uri, :title, :site_id, :tags, :browsers].freeze
31
30
  CSV_FIELDS = [:tags, :browsers].freeze
32
31
 
33
32
  def process
@@ -37,32 +36,31 @@ module RainforestCli::TestParser
37
36
  text.lines.each_with_index do |line, line_no|
38
37
  line = line.chomp
39
38
  if line[0..1] == '#!'
40
- # special comment, don't ignore!
41
39
  @test.rfml_id = line[2..-1].strip.split(' ')[0]
42
- @test.description += line[1..-1] + "\n"
43
40
 
44
41
  elsif line[0] == '#'
45
- # comment, store in description
46
- @test.description += line[1..-1] + "\n"
42
+ comment = line[1..-1].strip
47
43
 
48
- if line[1..-1].strip[0..8] == 'redirect:'
49
- value = line[1..-1].split(' ')[1..-1].join(' ').strip
44
+ if comment.start_with?('redirect:')
45
+ value = comment.split(' ')[1..-1].join(' ').strip
50
46
  if %(true false).include?(value)
51
47
  step_settings_scratch[:redirect] = value
52
48
  else
53
49
  @test.errors[line_no] = Error.new(line_no, 'Redirection value must be true or false')
54
50
  end
55
- end
56
-
57
- (CSV_FIELDS + TEST_DATA_FIELDS).each do |field|
58
- next unless line[1..-1].strip[0..(field.length)] == "#{field}:"
59
-
60
- # extract just the text of the field
61
- @test[field] = line[1..-1].split(' ')[1..-1].join(' ').strip
51
+ else
52
+ matched_field = TEST_DATA_FIELDS.find { |f| comment.start_with?("#{f}:") }
53
+ if matched_field.nil?
54
+ # comment, store in description
55
+ @test.description += comment + "\n"
56
+ else
57
+ # extract just the text of the field
58
+ @test[matched_field] = comment.split(' ')[1..-1].join(' ').strip
62
59
 
63
- # if it's supposed to be a CSV field, split and trim it
64
- if CSV_FIELDS.include?(field)
65
- @test[field] = @test[field].split(',').map(&:strip).map(&:downcase)
60
+ # if it's supposed to be a CSV field, split and trim it
61
+ if CSV_FIELDS.include?(matched_field)
62
+ @test[matched_field] = @test[matched_field].split(',').map(&:strip).map(&:downcase)
63
+ end
66
64
  end
67
65
  end
68
66
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module RainforestCli
3
- VERSION = '1.10.3'
3
+ VERSION = '1.10.4'
4
4
  end
@@ -3,6 +3,9 @@
3
3
  # tags: foo,bar,baz
4
4
  # site_id: 456
5
5
  # start_uri: /start_uri
6
+ # This is a comment
6
7
 
8
+ # this is also a comment
9
+ # redirect: false
7
10
  This is a step action.
8
11
  This is a question?
@@ -2,14 +2,35 @@
2
2
  describe RainforestCli::TestParser do
3
3
  describe RainforestCli::TestParser::Parser do
4
4
  subject { described_class.new(file_name) }
5
+ let(:file_name) { './spec/rainforest-example/example_test.rfml' }
5
6
 
6
7
  describe '#initialize' do
7
- let(:file_name) { './spec/rainforest-example/example_test.rfml' }
8
-
9
8
  it 'expands the file name path' do
10
9
  test = subject.instance_variable_get(:@test)
11
10
  expect(test.file_name).to eq(File.expand_path(file_name))
12
11
  end
13
12
  end
13
+
14
+ describe '#process' do
15
+ let(:parsed_test) { subject.process }
16
+ let(:parsed_step) { parsed_test.steps.first }
17
+
18
+ describe 'parsing comments' do
19
+ it 'properly identifies comments' do
20
+ expect(parsed_test.description).to include('This is a comment', 'this is also a comment')
21
+ end
22
+
23
+ it 'properly identifies metadata fields' do
24
+ expect(parsed_test.title).to eq('Example Test')
25
+ expect(parsed_test.tags).to eq(['foo', 'bar', 'baz'])
26
+ expect(parsed_test.site_id).to eq('456')
27
+ expect(parsed_test.start_uri).to eq('/start_uri')
28
+ end
29
+
30
+ it 'properly parses step metadata' do
31
+ expect(parsed_step.redirect).to eq('false')
32
+ end
33
+ end
34
+ end
14
35
  end
15
36
  end
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.10.3
4
+ version: 1.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Russell Smith
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-21 00:00:00.000000000 Z
12
+ date: 2016-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty