pairwise 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/features/bugs/bad_yml.feature +16 -0
- data/features/generating_pairwise_data.feature +13 -0
- data/lib/pairwise/cli.rb +11 -2
- data/lib/pairwise/formatter/cucumber.rb +5 -5
- metadata +2 -2
data/VERSION.yml
CHANGED
@@ -7,3 +7,19 @@ Scenario: Empty yml
|
|
7
7
|
"""
|
8
8
|
When I run pairwise inputs.yml
|
9
9
|
Then it should not show any errors
|
10
|
+
And I should see in the output
|
11
|
+
"""
|
12
|
+
Error: 'inputs.yml' does not contain the right yaml structure for me to generate the pairwise set!
|
13
|
+
"""
|
14
|
+
|
15
|
+
Scenario: yml with no lists
|
16
|
+
Given I have the yaml file "listey_inputs.yml" containing:
|
17
|
+
"""
|
18
|
+
mookey
|
19
|
+
"""
|
20
|
+
When I run pairwise listey_inputs.yml
|
21
|
+
Then it should not show any errors
|
22
|
+
And I should see in the output
|
23
|
+
"""
|
24
|
+
Error: 'listey_inputs.yml' does not contain the right yaml structure for me to generate the pairwise set!
|
25
|
+
"""
|
@@ -56,6 +56,19 @@ Scenario: Unorderd yaml inputs
|
|
56
56
|
|
57
57
|
"""
|
58
58
|
|
59
|
+
Scenario: Single value yaml inputs
|
60
|
+
Given I have the yaml file "inputs.yml" containing:
|
61
|
+
"""
|
62
|
+
1: 1
|
63
|
+
2: 2
|
64
|
+
"""
|
65
|
+
When I run pairwise inputs.yml
|
66
|
+
Then I should see the output
|
67
|
+
"""
|
68
|
+
| 1 | 2 |
|
69
|
+
| 1 | 2 |
|
70
|
+
|
71
|
+
"""
|
59
72
|
Scenario: Not replacing wild cards
|
60
73
|
Given I have the yaml file "inputs.yml" containing:
|
61
74
|
"""
|
data/lib/pairwise/cli.rb
CHANGED
@@ -41,12 +41,14 @@ module Pairwise
|
|
41
41
|
exit_with_help if @input_file.nil? || @input_file.empty?
|
42
42
|
|
43
43
|
inputs = YAML.load_file(@input_file)
|
44
|
-
if inputs
|
44
|
+
if valid_inputs?(inputs)
|
45
45
|
input_data, input_labels = *parse_input_data!(inputs)
|
46
46
|
|
47
47
|
builder = Pairwise::Builder.new(input_data, @options)
|
48
48
|
|
49
49
|
@formatter.display(builder.build, input_labels)
|
50
|
+
else
|
51
|
+
puts "Error: '#{@input_file}' does not contain the right yaml structure for me to generate the pairwise set!"
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
@@ -55,6 +57,10 @@ module Pairwise
|
|
55
57
|
{:keep_wild_cards => false}
|
56
58
|
end
|
57
59
|
|
60
|
+
def valid_inputs?(inputs)
|
61
|
+
inputs && (inputs.is_a?(Array) || inputs.is_a?(Hash))
|
62
|
+
end
|
63
|
+
|
58
64
|
def exit_with_help
|
59
65
|
@out.puts @args.options.help
|
60
66
|
Kernel.exit(0)
|
@@ -70,7 +76,10 @@ module Pairwise
|
|
70
76
|
end
|
71
77
|
|
72
78
|
def hash_inputs_to_list(inputs_hash)
|
73
|
-
inputs_hash.map
|
79
|
+
inputs_hash.map do |key, value|
|
80
|
+
value = [value] unless value.is_a?(Array)
|
81
|
+
{key => value}
|
82
|
+
end
|
74
83
|
end
|
75
84
|
|
76
85
|
def input_names(inputs)
|
@@ -8,9 +8,9 @@ module Pairwise
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def display(test_data, input_labels)
|
11
|
-
@test_data = label_wild_cards(test_data, input_labels)
|
11
|
+
@test_data = label_wild_cards(test_data, input_labels)
|
12
12
|
@input_labels = input_labels
|
13
|
-
|
13
|
+
|
14
14
|
@out.print "|"
|
15
15
|
@input_labels.each_with_index do |label, column|
|
16
16
|
@out.print padded_string(label, column) + "|"
|
@@ -34,14 +34,14 @@ module Pairwise
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def padded_string(string, column)
|
39
|
-
padding_length = max_line_length(column) - string.length
|
39
|
+
padding_length = max_line_length(column) - string.to_s.length
|
40
40
|
" #{string} " + (" " * padding_length)
|
41
41
|
end
|
42
42
|
|
43
43
|
def max_line_length(column)
|
44
|
-
@max[column] ||= ([@input_labels[column].length] + @test_data.map{|data| data[column].length}).max
|
44
|
+
@max[column] ||= ([@input_labels[column].to_s.length] + @test_data.map{|data| data[column].to_s.length}).max
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pairwise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Wilk
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-09 00:00:00 +00:00
|
13
13
|
default_executable: pairwise
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|