pairwise 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +17 -0
- data/lib/pairwise.rb +3 -0
- data/lib/pairwise/input_data.rb +1 -1
- data/lib/pairwise/input_file.rb +5 -2
- data/lib/pairwise/pair_collection.rb +3 -12
- data/spec/pairwise/builder_spec.rb +1 -1
- data/spec/pairwise/cli_spec.rb +1 -1
- data/spec/pairwise/pair_collection_spec.rb +15 -0
- data/spec/pairwise_spec.rb +6 -10
- data/spec/spec_helper.rb +4 -1
- metadata +28 -45
- data/.gitignore +0 -6
- data/LICENSE +0 -22
- data/README.rdoc +0 -13
- data/Rakefile +0 -25
- data/VERSION.yml +0 -5
- data/bin/pairwise +0 -7
- data/features/bugs/bad_arguments.feature +0 -32
- data/features/bugs/bad_yml.feature +0 -25
- data/features/customizing_pairwise_output_format.feature +0 -27
- data/features/generating_pairwise_data.feature +0 -118
- data/features/step_definitions/pairwise_data_steps.rb +0 -32
- data/features/support/env.rb +0 -82
- data/features/support/hooks.rb +0 -4
- data/gem_tasks/features.rake +0 -10
- data/gem_tasks/rspec.rake +0 -15
- data/spec/spec.opts +0 -4
data/README.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
Pairwise
|
2
|
+
-------
|
3
|
+
|
4
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/josephwilk/pairwise)
|
5
|
+
[![Build Status](https://secure.travis-ci.org/josephwilk/pairwise.png)](http://travis-ci.org/josephwilk/pairwise)
|
6
|
+
|
7
|
+
Documentation is at http://github.com/josephwilk/pairwise/wikis/home/
|
8
|
+
|
9
|
+
Running tests
|
10
|
+
------------
|
11
|
+
<pre><code>rake</code></pre>
|
12
|
+
|
13
|
+
|
14
|
+
Copyright
|
15
|
+
--------
|
16
|
+
|
17
|
+
Copyright (c) 2009,2010,2011,2012 Joseph Wilk. See LICENSE for details.
|
data/lib/pairwise.rb
CHANGED
data/lib/pairwise/input_data.rb
CHANGED
data/lib/pairwise/input_file.rb
CHANGED
@@ -11,18 +11,8 @@ module Pairwise
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def input_combination_that_covers_most_pairs(input_combination, input_values_for_growth)
|
14
|
-
|
15
|
-
|
16
|
-
input_combination_candidate = input_combination + [value]
|
17
|
-
covered_count = pairs_covered_count(input_combination_candidate)
|
18
|
-
if covered_count >= max_covered_count
|
19
|
-
selected_input_combination = input_combination_candidate
|
20
|
-
covered_count
|
21
|
-
else
|
22
|
-
max_covered_count
|
23
|
-
end
|
24
|
-
end
|
25
|
-
selected_input_combination
|
14
|
+
candidates = input_values_for_growth.map{|value| input_combination + [value]}
|
15
|
+
candidates.max {|combination_1, combination_2| pairs_covered_count(combination_1) <=> pairs_covered_count(combination_2)}
|
26
16
|
end
|
27
17
|
|
28
18
|
def to_a
|
@@ -30,6 +20,7 @@ module Pairwise
|
|
30
20
|
end
|
31
21
|
|
32
22
|
private
|
23
|
+
|
33
24
|
def generate_pairs_between(input_parameter_values, input_value_lists, input_parameter_index)
|
34
25
|
pairs = []
|
35
26
|
input_parameter_values.each do |input_value_a|
|
data/spec/pairwise/cli_spec.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Pairwise
|
4
|
+
describe PairCollection do
|
5
|
+
describe '#input_combination_that_covers_most_pairs' do
|
6
|
+
it "should do find the combination that covers most pairs" do
|
7
|
+
pair_collection = PairCollection.new([:A2, :B2], [[:A2, :B2], [:B2, :A1]], 1)
|
8
|
+
|
9
|
+
combination = pair_collection.input_combination_that_covers_most_pairs([:A2, :B2], [:C2, :A1])
|
10
|
+
|
11
|
+
combination.should == [:A2, :B2, :C2]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/spec/pairwise_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Pairwise do
|
4
4
|
before(:each) do
|
@@ -96,15 +96,11 @@ describe Pairwise do
|
|
96
96
|
it "should generate all pairs for 4 parameters of 2,1,2,2 values" do
|
97
97
|
data = [[:A1, :A2], [:B1], [:C1, :C2], [:D1, :D2]]
|
98
98
|
|
99
|
-
Pairwise.combinations(*data).should == [[:A1, :B1, :C1, :D1],
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
#:A1, :B1, :C1, :D1
|
105
|
-
#:A1, :B1, :C2, :D2
|
106
|
-
#:A2, any_value_of_B, :C2, :D1
|
107
|
-
#:A2, :B1, :C1, :D2
|
99
|
+
Pairwise.combinations(*data).should == [[:A1, :B1, :C1, :D1],
|
100
|
+
[:A2, :B1, :C2, :D2],
|
101
|
+
[:A2, :B1, :C1, :D1],
|
102
|
+
[:A1, :B1, :C2, :D1],
|
103
|
+
[:A1, :B1, :C1, :D2]]
|
108
104
|
end
|
109
105
|
|
110
106
|
it "should generate pairs for three parameters" do
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pairwise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.8
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Joseph Wilk
|
@@ -9,99 +10,81 @@ autorequire:
|
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
12
|
|
12
|
-
date:
|
13
|
-
default_executable: pairwise
|
13
|
+
date: 2012-08-17 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
|
-
|
24
|
+
type: :development
|
25
|
+
version_requirements: *id001
|
25
26
|
- !ruby/object:Gem::Dependency
|
26
27
|
name: cucumber
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
30
31
|
requirements:
|
31
32
|
- - ">="
|
32
33
|
- !ruby/object:Gem::Version
|
33
34
|
version: "0"
|
34
|
-
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id002
|
35
37
|
description: A tool for selecting a smaller number of test combinations (using pairwise generation) rather than exhaustively testing all possible permutations.
|
36
38
|
email: joe@josephwilk.net
|
37
|
-
executables:
|
38
|
-
|
39
|
+
executables: []
|
40
|
+
|
39
41
|
extensions: []
|
40
42
|
|
41
|
-
extra_rdoc_files:
|
42
|
-
|
43
|
-
- README.rdoc
|
43
|
+
extra_rdoc_files: []
|
44
|
+
|
44
45
|
files:
|
45
|
-
- .
|
46
|
-
- LICENSE
|
47
|
-
- README.rdoc
|
48
|
-
- Rakefile
|
49
|
-
- VERSION.yml
|
50
|
-
- bin/pairwise
|
51
|
-
- features/bugs/bad_arguments.feature
|
52
|
-
- features/bugs/bad_yml.feature
|
53
|
-
- features/customizing_pairwise_output_format.feature
|
54
|
-
- features/generating_pairwise_data.feature
|
55
|
-
- features/step_definitions/pairwise_data_steps.rb
|
56
|
-
- features/support/env.rb
|
57
|
-
- features/support/hooks.rb
|
58
|
-
- gem_tasks/features.rake
|
59
|
-
- gem_tasks/rspec.rake
|
60
|
-
- lib/pairwise.rb
|
46
|
+
- README.md
|
61
47
|
- lib/pairwise/builder.rb
|
62
48
|
- lib/pairwise/cli.rb
|
63
|
-
- lib/pairwise/formatter.rb
|
64
49
|
- lib/pairwise/formatter/csv.rb
|
65
50
|
- lib/pairwise/formatter/cucumber.rb
|
51
|
+
- lib/pairwise/formatter.rb
|
66
52
|
- lib/pairwise/input_data.rb
|
67
53
|
- lib/pairwise/input_file.rb
|
68
54
|
- lib/pairwise/pair_collection.rb
|
69
55
|
- lib/pairwise/test_pair.rb
|
56
|
+
- lib/pairwise.rb
|
70
57
|
- spec/pairwise/builder_spec.rb
|
71
58
|
- spec/pairwise/cli_spec.rb
|
59
|
+
- spec/pairwise/pair_collection_spec.rb
|
72
60
|
- spec/pairwise_spec.rb
|
73
|
-
- spec/spec.opts
|
74
61
|
- spec/spec_helper.rb
|
75
|
-
has_rdoc: true
|
76
62
|
homepage: http://wiki.github.com/josephwilk/pairwise
|
77
63
|
licenses: []
|
78
64
|
|
79
65
|
post_install_message:
|
80
|
-
rdoc_options:
|
81
|
-
|
66
|
+
rdoc_options: []
|
67
|
+
|
82
68
|
require_paths:
|
83
69
|
- lib
|
84
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
85
72
|
requirements:
|
86
73
|
- - ">="
|
87
74
|
- !ruby/object:Gem::Version
|
88
75
|
version: "0"
|
89
|
-
version:
|
90
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
91
78
|
requirements:
|
92
79
|
- - ">="
|
93
80
|
- !ruby/object:Gem::Version
|
94
81
|
version: "0"
|
95
|
-
version:
|
96
82
|
requirements: []
|
97
83
|
|
98
84
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.
|
85
|
+
rubygems_version: 1.8.24
|
100
86
|
signing_key:
|
101
87
|
specification_version: 3
|
102
88
|
summary: Turn large test data combinations into smaller ones
|
103
|
-
test_files:
|
104
|
-
|
105
|
-
- spec/pairwise/cli_spec.rb
|
106
|
-
- spec/pairwise_spec.rb
|
107
|
-
- spec/spec_helper.rb
|
89
|
+
test_files: []
|
90
|
+
|
data/.gitignore
DELETED
data/LICENSE
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
The MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2009 Joseph Wilk
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
= Pairwise
|
2
|
-
|
3
|
-
Documentation is at http://github.com/josephwilk/pairwise/wikis/home/
|
4
|
-
|
5
|
-
== Running tests
|
6
|
-
|
7
|
-
rake
|
8
|
-
|
9
|
-
If you get errors about missing gems - just install them.
|
10
|
-
|
11
|
-
== Copyright
|
12
|
-
|
13
|
-
Copyright (c) 2009,2010 Joseph Wilk. See LICENSE for details.
|
data/Rakefile
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "pairwise"
|
8
|
-
gem.summary = %Q{Turn large test data combinations into smaller ones}
|
9
|
-
gem.description = %Q{A tool for selecting a smaller number of test combinations (using pairwise generation) rather than exhaustively testing all possible permutations.}
|
10
|
-
gem.email = "joe@josephwilk.net"
|
11
|
-
gem.homepage = "http://wiki.github.com/josephwilk/pairwise"
|
12
|
-
gem.authors = ["Joseph Wilk"]
|
13
|
-
|
14
|
-
gem.add_development_dependency 'rspec'
|
15
|
-
gem.add_development_dependency 'cucumber'
|
16
|
-
end
|
17
|
-
|
18
|
-
Jeweler::GemcutterTasks.new
|
19
|
-
rescue LoadError
|
20
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
21
|
-
end
|
22
|
-
|
23
|
-
Dir['gem_tasks/**/*.rake'].each { |rake| load rake }
|
24
|
-
|
25
|
-
task :default => ["spec", "features"]
|
data/VERSION.yml
DELETED
data/bin/pairwise
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
Feature: Bad arguments
|
2
|
-
|
3
|
-
Scenario: Non existent file
|
4
|
-
When I run pairwise file_with_does_not_exist
|
5
|
-
And I should see in the errors
|
6
|
-
"""
|
7
|
-
No such file or directory
|
8
|
-
"""
|
9
|
-
|
10
|
-
Scenario: Existing folder
|
11
|
-
Given I have a folder "empty"
|
12
|
-
When I run pairwise empty/
|
13
|
-
Then I should see in the output
|
14
|
-
"""
|
15
|
-
Usage: pairwise
|
16
|
-
"""
|
17
|
-
|
18
|
-
Scenario: Unsupported input file type
|
19
|
-
Given I have the file "example.rar"
|
20
|
-
When I run pairwise example.rar
|
21
|
-
Then I should see in the errors
|
22
|
-
"""
|
23
|
-
Unsupported file type: rar
|
24
|
-
"""
|
25
|
-
|
26
|
-
Scenario: Unsupported input file without extension
|
27
|
-
Given I have the file "example"
|
28
|
-
When I run pairwise example
|
29
|
-
Then I should see in the errors
|
30
|
-
"""
|
31
|
-
Cannot determine file type for: example
|
32
|
-
"""
|
@@ -1,25 +0,0 @@
|
|
1
|
-
Feature: Bad yml
|
2
|
-
|
3
|
-
Scenario: Empty yml
|
4
|
-
Given I have the yaml file "inputs.yml" containing:
|
5
|
-
"""
|
6
|
-
|
7
|
-
"""
|
8
|
-
When I run pairwise inputs.yml
|
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 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 structure for me to generate the pairwise set!
|
25
|
-
"""
|
@@ -1,27 +0,0 @@
|
|
1
|
-
Feature: Customizing pairwise output format
|
2
|
-
In order to save time importing pairwise sets
|
3
|
-
As a tester
|
4
|
-
I want the output pairwise data to be in the most convenient format for me
|
5
|
-
|
6
|
-
Scenario: formatting output as csv
|
7
|
-
Given I have the yaml file "inputs.yml" containing:
|
8
|
-
"""
|
9
|
-
- event with image: [Football, Basketball, Soccer]
|
10
|
-
- event without image: [Football, Basketball, Soccer]
|
11
|
-
- media: [Image, Video, Music]
|
12
|
-
"""
|
13
|
-
When I run pairwise inputs.yml --format csv
|
14
|
-
Then I should see the output
|
15
|
-
"""
|
16
|
-
event with image,event without image,media
|
17
|
-
Football,Football,Image
|
18
|
-
Football,Basketball,Video
|
19
|
-
Football,Soccer,Music
|
20
|
-
Basketball,Football,Music
|
21
|
-
Basketball,Basketball,Image
|
22
|
-
Basketball,Soccer,Video
|
23
|
-
Soccer,Football,Video
|
24
|
-
Soccer,Basketball,Music
|
25
|
-
Soccer,Soccer,Image
|
26
|
-
|
27
|
-
"""
|
@@ -1,118 +0,0 @@
|
|
1
|
-
Feature: Generating pairwise data
|
2
|
-
In order to test small, managable datasets while having confidence in test coverage
|
3
|
-
As a tester
|
4
|
-
I want a set of tests which is smaller than all the possible combinations of my specified inputs
|
5
|
-
|
6
|
-
Scenario: No input file specified
|
7
|
-
When I run pairwise
|
8
|
-
Then I should see in the output
|
9
|
-
"""
|
10
|
-
Usage: pairwise [options] FILE.[yml|csv]
|
11
|
-
"""
|
12
|
-
|
13
|
-
Scenario: Ordered yaml inputs
|
14
|
-
Given I have the yaml file "inputs.yml" containing:
|
15
|
-
"""
|
16
|
-
- event with image: [Football, Basketball, Soccer]
|
17
|
-
- event without image: [Football, Basketball, Soccer]
|
18
|
-
- media: [Image, Video, Music]
|
19
|
-
"""
|
20
|
-
When I run pairwise inputs.yml
|
21
|
-
Then I should see the output
|
22
|
-
"""
|
23
|
-
| event with image | event without image | media |
|
24
|
-
| Football | Football | Image |
|
25
|
-
| Football | Basketball | Video |
|
26
|
-
| Football | Soccer | Music |
|
27
|
-
| Basketball | Football | Music |
|
28
|
-
| Basketball | Basketball | Image |
|
29
|
-
| Basketball | Soccer | Video |
|
30
|
-
| Soccer | Football | Video |
|
31
|
-
| Soccer | Basketball | Music |
|
32
|
-
| Soccer | Soccer | Image |
|
33
|
-
|
34
|
-
"""
|
35
|
-
|
36
|
-
Scenario: Unorderd yaml inputs
|
37
|
-
Given I have the yaml file "inputs.yml" containing:
|
38
|
-
"""
|
39
|
-
event with image: [Football, Basketball, Soccer]
|
40
|
-
event without image: [Football, Basketball, Soccer]
|
41
|
-
media: [Image, Video, Music]
|
42
|
-
"""
|
43
|
-
When I run pairwise inputs.yml
|
44
|
-
Then I should see the output
|
45
|
-
"""
|
46
|
-
| media | event without image | event with image |
|
47
|
-
| Image | Football | Football |
|
48
|
-
| Image | Basketball | Basketball |
|
49
|
-
| Image | Soccer | Soccer |
|
50
|
-
| Video | Football | Soccer |
|
51
|
-
| Video | Basketball | Football |
|
52
|
-
| Video | Soccer | Basketball |
|
53
|
-
| Music | Football | Basketball |
|
54
|
-
| Music | Basketball | Soccer |
|
55
|
-
| Music | Soccer | Football |
|
56
|
-
|
57
|
-
"""
|
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
|
-
"""
|
72
|
-
|
73
|
-
Scenario: inputing as csv
|
74
|
-
Given I have the csv file "inputs.csv" containing:
|
75
|
-
"""
|
76
|
-
media, event with image, event without image
|
77
|
-
Image, Football, Football
|
78
|
-
Video, Basketball, Basketball
|
79
|
-
Music, Soccer, Soccer
|
80
|
-
"""
|
81
|
-
When I run pairwise inputs.csv
|
82
|
-
Then I should see the output
|
83
|
-
"""
|
84
|
-
| media | event without image | event with image |
|
85
|
-
| Image | Football | Football |
|
86
|
-
| Image | Basketball | Basketball |
|
87
|
-
| Image | Soccer | Soccer |
|
88
|
-
| Video | Football | Soccer |
|
89
|
-
| Video | Basketball | Football |
|
90
|
-
| Video | Soccer | Basketball |
|
91
|
-
| Music | Football | Basketball |
|
92
|
-
| Music | Basketball | Soccer |
|
93
|
-
| Music | Soccer | Football |
|
94
|
-
|
95
|
-
"""
|
96
|
-
|
97
|
-
Scenario: Not replacing wild cards
|
98
|
-
Given I have the yaml file "inputs.yml" containing:
|
99
|
-
"""
|
100
|
-
- A: [A1, A2, A3]
|
101
|
-
- B: [B1, B2]
|
102
|
-
- C: [C1, C2, C3]
|
103
|
-
"""
|
104
|
-
When I run pairwise inputs.yml --keep-wild-cards
|
105
|
-
Then I should see the output
|
106
|
-
"""
|
107
|
-
| A | B | C |
|
108
|
-
| A1 | B1 | C1 |
|
109
|
-
| A1 | B2 | C2 |
|
110
|
-
| A2 | B1 | C3 |
|
111
|
-
| A2 | B2 | C1 |
|
112
|
-
| A3 | B1 | C2 |
|
113
|
-
| A3 | B2 | C3 |
|
114
|
-
| A3 | any_value_of_B | C1 |
|
115
|
-
| A2 | any_value_of_B | C2 |
|
116
|
-
| A1 | any_value_of_B | C3 |
|
117
|
-
|
118
|
-
"""
|
@@ -1,32 +0,0 @@
|
|
1
|
-
Given /^I have the (?:yaml |csv )?file "([^\"]*)" containing:$/ do |file_name, file_contents|
|
2
|
-
create_file(file_name, file_contents)
|
3
|
-
end
|
4
|
-
|
5
|
-
Given /^I have the file "([^\"]*)"$/ do |filename|
|
6
|
-
Given %Q{I have the file "#{filename}" containing:}, ""
|
7
|
-
end
|
8
|
-
|
9
|
-
Given /^I have a folder "([^\"]*)"$/ do |folder_name|
|
10
|
-
create_folder(folder_name)
|
11
|
-
end
|
12
|
-
|
13
|
-
When /^I run (.+)$/ do |command|
|
14
|
-
run(command)
|
15
|
-
end
|
16
|
-
|
17
|
-
Then /^I should see the output$/ do |text|
|
18
|
-
last_stdout.should == text
|
19
|
-
end
|
20
|
-
|
21
|
-
Then /^I should see in the output$/ do |string|
|
22
|
-
Then "it should not show any errors"
|
23
|
-
last_stdout.should include(string)
|
24
|
-
end
|
25
|
-
|
26
|
-
Then /^I should see in the errors$/ do |string|
|
27
|
-
last_stderr.should include(string)
|
28
|
-
end
|
29
|
-
|
30
|
-
Then /^it should not show any errors$/ do
|
31
|
-
last_stderr.should == ""
|
32
|
-
end
|
data/features/support/env.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'tempfile'
|
3
|
-
require 'spec/expectations'
|
4
|
-
require "spec/mocks"
|
5
|
-
require 'fileutils'
|
6
|
-
require 'forwardable'
|
7
|
-
|
8
|
-
SCRATCH_SPACE = 'tmp'
|
9
|
-
|
10
|
-
class PairwiseWorld
|
11
|
-
extend Forwardable
|
12
|
-
def_delegators PairwiseWorld, :self_test_dir
|
13
|
-
|
14
|
-
def self.examples_dir(subdir=nil)
|
15
|
-
@examples_dir ||= File.expand_path(File.join(File.dirname(__FILE__), "../../#{SCRATCH_SPACE}"))
|
16
|
-
subdir ? File.join(@examples_dir, subdir) : @examples_dir
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.self_test_dir
|
20
|
-
@self_test_dir ||= examples_dir
|
21
|
-
end
|
22
|
-
|
23
|
-
def pairwise_lib_dir
|
24
|
-
@pairwise_lib_dir ||= File.expand_path(File.join(File.dirname(__FILE__), '../../lib'))
|
25
|
-
end
|
26
|
-
|
27
|
-
def initialize
|
28
|
-
@current_dir = self_test_dir
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
attr_reader :last_exit_status, :last_stderr
|
33
|
-
|
34
|
-
def last_stdout
|
35
|
-
@last_stdout
|
36
|
-
end
|
37
|
-
|
38
|
-
def create_file(file_name, file_content)
|
39
|
-
in_current_dir do
|
40
|
-
FileUtils.mkdir_p(File.dirname(file_name)) unless File.directory?(File.dirname(file_name))
|
41
|
-
File.open(file_name, 'w') { |f| f << file_content }
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def create_folder(folder_name)
|
46
|
-
in_current_dir do
|
47
|
-
FileUtils.mkdir_p(folder_name) unless File.directory?(folder_name)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def set_env_var(variable, value)
|
52
|
-
@original_env_vars ||= {}
|
53
|
-
@original_env_vars[variable] = ENV[variable]
|
54
|
-
ENV[variable] = value
|
55
|
-
end
|
56
|
-
|
57
|
-
def in_current_dir(&block)
|
58
|
-
Dir.chdir(@current_dir, &block)
|
59
|
-
end
|
60
|
-
|
61
|
-
def run(command)
|
62
|
-
stderr_file = Tempfile.new('pairwise')
|
63
|
-
stderr_file.close
|
64
|
-
in_current_dir do
|
65
|
-
IO.popen("../bin/#{command} 2> #{stderr_file.path}", 'r') do |io|
|
66
|
-
@last_stdout = io.read
|
67
|
-
end
|
68
|
-
|
69
|
-
@last_exit_status = $?.exitstatus
|
70
|
-
end
|
71
|
-
@last_stderr = IO.read(stderr_file.path)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
World do
|
76
|
-
PairwiseWorld.new
|
77
|
-
end
|
78
|
-
|
79
|
-
Before do
|
80
|
-
FileUtils.rm_rf SCRATCH_SPACE
|
81
|
-
FileUtils.mkdir SCRATCH_SPACE
|
82
|
-
end
|
data/features/support/hooks.rb
DELETED
data/gem_tasks/features.rake
DELETED
data/gem_tasks/rspec.rake
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
require 'spec/expectations'
|
3
|
-
require 'spec/rake/spectask'
|
4
|
-
|
5
|
-
desc "Run RSpec"
|
6
|
-
Spec::Rake::SpecTask.new do |t|
|
7
|
-
t.spec_opts = ['--options', "spec/spec.opts"]
|
8
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
9
|
-
t.rcov = ENV['RCOV']
|
10
|
-
t.rcov_opts = %w{--exclude gems\/,spec\/}
|
11
|
-
t.verbose = true
|
12
|
-
end
|
13
|
-
rescue LoadError
|
14
|
-
task :spec
|
15
|
-
end
|
data/spec/spec.opts
DELETED