mortadella 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/.ruby-version +1 -1
- data/Gemfile.lock +40 -54
- data/README.md +3 -0
- data/Rakefile +2 -0
- data/bin/features +3 -0
- data/bin/lint +3 -0
- data/bin/spec +3 -0
- data/circle.yml +6 -2
- data/features/horizontal_tables/keep_matching_columns.feature +21 -0
- data/features/step_definitions/steps.rb +3 -2
- data/features/support/env.rb +2 -0
- data/lib/mortadella.rb +2 -0
- data/lib/mortadella/horizontal.rb +22 -0
- data/lib/mortadella/vertical.rb +2 -0
- data/mortadella.gemspec +1 -1
- data/tertestrial.yml +1 -0
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8407029c2d5cd020b7a483e019700865593b13ac
|
4
|
+
data.tar.gz: c29722d238f627040fe34dbd426397c90a9d5ec4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0fc2d19ab303a4fc51b07485673efb5944a84e665ceba63a0d064cb16819e612cdab3ffefd8d04a384882f38677f1b7ee818d719327263f7a007a23b955e3b29
|
7
|
+
data.tar.gz: 60e695b045dbae6a5120db6ffa7a41dba51ec69bbb9dd1ac8b9ef3b4969cf5cf3464c26e676ed6c76d878f8d2a328ea595e8fa3bfafbdff8d0fba3837684f409
|
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.1
|
data/Gemfile.lock
CHANGED
@@ -1,85 +1,71 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mortadella (1.
|
4
|
+
mortadella (1.1.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
ast (2.
|
10
|
-
astrolabe (1.3.1)
|
11
|
-
parser (~> 2.2)
|
9
|
+
ast (2.3.0)
|
12
10
|
builder (3.2.2)
|
13
|
-
coveralls (0.8.
|
14
|
-
json (
|
15
|
-
|
16
|
-
simplecov (~> 0.11.0)
|
11
|
+
coveralls (0.8.15)
|
12
|
+
json (>= 1.8, < 3)
|
13
|
+
simplecov (~> 0.12.0)
|
17
14
|
term-ansicolor (~> 1.3)
|
18
15
|
thor (~> 0.19.1)
|
19
|
-
tins (
|
20
|
-
cucumber (2.
|
16
|
+
tins (>= 1.6.0, < 2)
|
17
|
+
cucumber (2.4.0)
|
21
18
|
builder (>= 2.1.2)
|
22
|
-
cucumber-core (~> 1.
|
19
|
+
cucumber-core (~> 1.5.0)
|
20
|
+
cucumber-wire (~> 0.0.1)
|
23
21
|
diff-lcs (>= 1.1.3)
|
24
|
-
|
22
|
+
gherkin (~> 4.0)
|
25
23
|
multi_json (>= 1.7.5, < 2.0)
|
26
24
|
multi_test (>= 0.1.2)
|
27
|
-
cucumber-core (1.
|
28
|
-
|
25
|
+
cucumber-core (1.5.0)
|
26
|
+
gherkin (~> 4.0)
|
27
|
+
cucumber-wire (0.0.1)
|
29
28
|
diff-lcs (1.2.5)
|
30
29
|
docile (1.1.5)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
http-cookie (1.0.2)
|
35
|
-
domain_name (~> 0.5)
|
36
|
-
json (1.8.3)
|
37
|
-
mime-types (2.99)
|
38
|
-
multi_json (1.11.2)
|
30
|
+
gherkin (4.0.0)
|
31
|
+
json (2.0.2)
|
32
|
+
multi_json (1.12.1)
|
39
33
|
multi_test (0.1.2)
|
40
|
-
|
41
|
-
|
42
|
-
ast (>= 1.1, < 3.0)
|
34
|
+
parser (2.3.1.2)
|
35
|
+
ast (~> 2.2)
|
43
36
|
powerpack (0.1.1)
|
44
|
-
rainbow (2.
|
45
|
-
rake (
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
rspec (3.
|
51
|
-
rspec-
|
52
|
-
|
53
|
-
rspec-mocks (~> 3.4.0)
|
54
|
-
rspec-core (3.4.1)
|
55
|
-
rspec-support (~> 3.4.0)
|
56
|
-
rspec-expectations (3.4.0)
|
37
|
+
rainbow (2.1.0)
|
38
|
+
rake (11.2.2)
|
39
|
+
rspec (3.5.0)
|
40
|
+
rspec-core (~> 3.5.0)
|
41
|
+
rspec-expectations (~> 3.5.0)
|
42
|
+
rspec-mocks (~> 3.5.0)
|
43
|
+
rspec-core (3.5.2)
|
44
|
+
rspec-support (~> 3.5.0)
|
45
|
+
rspec-expectations (3.5.0)
|
57
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
58
|
-
rspec-support (~> 3.
|
59
|
-
rspec-mocks (3.
|
47
|
+
rspec-support (~> 3.5.0)
|
48
|
+
rspec-mocks (3.5.0)
|
60
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
61
|
-
rspec-support (~> 3.
|
62
|
-
rspec-support (3.
|
63
|
-
rubocop (0.
|
64
|
-
|
65
|
-
parser (>= 2.2.3.0, < 3.0)
|
50
|
+
rspec-support (~> 3.5.0)
|
51
|
+
rspec-support (3.5.0)
|
52
|
+
rubocop (0.42.0)
|
53
|
+
parser (>= 2.3.1.1, < 3.0)
|
66
54
|
powerpack (~> 0.1)
|
67
55
|
rainbow (>= 1.99.1, < 3.0)
|
68
56
|
ruby-progressbar (~> 1.7)
|
69
|
-
|
70
|
-
ruby-progressbar (1.
|
71
|
-
simplecov (0.
|
57
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
58
|
+
ruby-progressbar (1.8.1)
|
59
|
+
simplecov (0.12.0)
|
72
60
|
docile (~> 1.1.0)
|
73
|
-
json (
|
61
|
+
json (>= 1.8, < 3)
|
74
62
|
simplecov-html (~> 0.10.0)
|
75
63
|
simplecov-html (0.10.0)
|
76
64
|
term-ansicolor (1.3.2)
|
77
65
|
tins (~> 1.0)
|
78
66
|
thor (0.19.1)
|
79
|
-
tins (1.
|
80
|
-
|
81
|
-
unf_ext
|
82
|
-
unf_ext (0.0.7.1)
|
67
|
+
tins (1.12.0)
|
68
|
+
unicode-display_width (1.1.0)
|
83
69
|
|
84
70
|
PLATFORMS
|
85
71
|
ruby
|
@@ -94,4 +80,4 @@ DEPENDENCIES
|
|
94
80
|
rubocop
|
95
81
|
|
96
82
|
BUNDLED WITH
|
97
|
-
1.
|
83
|
+
1.11.2
|
data/README.md
CHANGED
@@ -58,6 +58,9 @@ Mortadella supports horizontal and vertical Cucumber tables.
|
|
58
58
|
[dry up repetitive fields](https://github.com/Originate/mortadella/blob/master/features/horizontal_tables/drying_up_fields.feature)
|
59
59
|
for better readability
|
60
60
|
|
61
|
+
* or filter the columns of your finished table by calling
|
62
|
+
[keep_matching_colums](features/horizontal_tables/keep_matching_columns.feature)
|
63
|
+
|
61
64
|
|
62
65
|
### Vertical Tables
|
63
66
|
|
data/Rakefile
CHANGED
data/bin/features
ADDED
data/bin/lint
ADDED
data/bin/spec
ADDED
data/circle.yml
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: removing empty rows
|
2
|
+
|
3
|
+
As a Cucumber user
|
4
|
+
I want to be able to filter my Mortadella table against a list of header columns names
|
5
|
+
So that my Mortadella table matches the structure of the Cucumber table to compare against precisely and I don't get false negative tests.
|
6
|
+
|
7
|
+
- call "keep_matching_columns" with an array of column names to filter out all mismatching columns
|
8
|
+
|
9
|
+
|
10
|
+
Scenario: filtering multiple columns
|
11
|
+
Given I create a horizontal Mortadella instance: "m = Mortadella::Horizontal.new headers: ['DAY', 'ACTIVITY', 'HIGH-SCORE', 'AVERAGE']"
|
12
|
+
And I add a data row: "m << ['Monday', 'mowing', '1.0', '0.5']"
|
13
|
+
And I add another data row: "m << ['Tuesday', 'tutoring', '2.0', '1.1']"
|
14
|
+
And I add another data row: "m << ['Wednesday', 'welcoming', '3.0', '2.2']"
|
15
|
+
When I filter column names: "m.keep_matching_columns ['DAY', 'HIGH-SCORE']"
|
16
|
+
And I request the instance data table "m.table"
|
17
|
+
Then Mortadella returns an object that matches this Cucumber table
|
18
|
+
| DAY | HIGH-SCORE |
|
19
|
+
| Monday | 1.0 |
|
20
|
+
| Tuesday | 2.0 |
|
21
|
+
| Wednesday | 3.0 |
|
@@ -1,9 +1,10 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Given(/^I (?:add|ask|create|filter|have|request) .+? "(.+?)"$/) do |code|
|
2
4
|
@result = eval "@#{code}"
|
3
5
|
end
|
4
6
|
|
5
7
|
|
6
|
-
|
7
8
|
Then(/^Mortadella returns/) do |table|
|
8
9
|
table.diff! @result
|
9
10
|
end
|
data/features/support/env.rb
CHANGED
data/lib/mortadella.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Mortadella
|
2
4
|
|
3
5
|
# Makes it easy to build DRY horizontal Cucumber-compatible tables
|
@@ -31,6 +33,15 @@ module Mortadella
|
|
31
33
|
end
|
32
34
|
|
33
35
|
|
36
|
+
def keep_matching_columns columns
|
37
|
+
columns_indeces_to_drop(columns).sort.reverse_each do |column_number|
|
38
|
+
@table.each do |row|
|
39
|
+
row.delete_at column_number
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
34
45
|
|
35
46
|
private
|
36
47
|
|
@@ -41,6 +52,17 @@ module Mortadella
|
|
41
52
|
end
|
42
53
|
|
43
54
|
|
55
|
+
# Returns the column indeces to drop to make this table have the given columns
|
56
|
+
def columns_indeces_to_drop columns
|
57
|
+
result = []
|
58
|
+
headers = @table[0]
|
59
|
+
headers.each_with_index do |header, i|
|
60
|
+
result << i unless columns.include? header
|
61
|
+
end
|
62
|
+
result
|
63
|
+
end
|
64
|
+
|
65
|
+
|
44
66
|
# Returns a dried up version of the given row
|
45
67
|
# based on the row that came before in the table
|
46
68
|
#
|
data/lib/mortadella/vertical.rb
CHANGED
data/mortadella.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'mortadella'
|
7
|
-
s.version = '1.
|
7
|
+
s.version = '1.1.0'
|
8
8
|
s.authors = ['Kevin Goslar']
|
9
9
|
s.email = ['kevin.goslar@gmail.com']
|
10
10
|
s.summary = %s(Mock Ruby Table Delivery)
|
data/tertestrial.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
actions: js-cucumber-mocha
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mortadella
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Goslar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,10 +110,14 @@ files:
|
|
110
110
|
- LICENSE.txt
|
111
111
|
- README.md
|
112
112
|
- Rakefile
|
113
|
+
- bin/features
|
114
|
+
- bin/lint
|
115
|
+
- bin/spec
|
113
116
|
- circle.yml
|
114
117
|
- features/horizontal_tables/basic_usage.feature
|
115
118
|
- features/horizontal_tables/drying_up_fields.feature
|
116
119
|
- features/horizontal_tables/emptiness.feature
|
120
|
+
- features/horizontal_tables/keep_matching_columns.feature
|
117
121
|
- features/step_definitions/steps.rb
|
118
122
|
- features/support/env.rb
|
119
123
|
- features/vertical_tables/basic_usage.feature
|
@@ -122,6 +126,7 @@ files:
|
|
122
126
|
- lib/mortadella/horizontal.rb
|
123
127
|
- lib/mortadella/vertical.rb
|
124
128
|
- mortadella.gemspec
|
129
|
+
- tertestrial.yml
|
125
130
|
homepage: https://github.com/Originate/mortadella
|
126
131
|
licenses:
|
127
132
|
- MIT
|
@@ -142,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
147
|
version: '0'
|
143
148
|
requirements: []
|
144
149
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.5.1
|
146
151
|
signing_key:
|
147
152
|
specification_version: 4
|
148
153
|
summary: Mock Ruby Table Delivery
|