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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: addead2f5fd8242211b456117c6473d64afbbd62
4
- data.tar.gz: 9184b1d1774cd478d4fb1772be9e4b4a68429f3d
3
+ metadata.gz: 8407029c2d5cd020b7a483e019700865593b13ac
4
+ data.tar.gz: c29722d238f627040fe34dbd426397c90a9d5ec4
5
5
  SHA512:
6
- metadata.gz: a508525b3f43f28b7b30e419eb4e24857c3e9eab229ab94ec7fc97fb17b4a6337edf8687de6b8f8acadc2159c76d056162dd335346262a5bf3c1e85d381bab34
7
- data.tar.gz: 06e1f982f1a0d0630ac771431c29cdc668f0dffd507b08c8e746f058cd757008ceb8cb1b35bd4abd86dd2900a17af63a51a03067f78ac8cca8ec70bc15121206
6
+ metadata.gz: 0fc2d19ab303a4fc51b07485673efb5944a84e665ceba63a0d064cb16819e612cdab3ffefd8d04a384882f38677f1b7ee818d719327263f7a007a23b955e3b29
7
+ data.tar.gz: 60e695b045dbae6a5120db6ffa7a41dba51ec69bbb9dd1ac8b9ef3b4969cf5cf3464c26e676ed6c76d878f8d2a328ea595e8fa3bfafbdff8d0fba3837684f409
data/.rubocop.yml CHANGED
@@ -28,7 +28,8 @@ Style/EmptyLinesAroundClassBody:
28
28
  Style/EmptyLinesAroundModuleBody:
29
29
  EnforcedStyle: empty_lines
30
30
 
31
-
31
+ Style/GuardClause:
32
+ Enabled: false
32
33
 
33
34
  Style/MethodDefParentheses:
34
35
  EnforcedStyle: require_no_parentheses
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.3.1
data/Gemfile.lock CHANGED
@@ -1,85 +1,71 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mortadella (1.0.0)
4
+ mortadella (1.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.2.0)
10
- astrolabe (1.3.1)
11
- parser (~> 2.2)
9
+ ast (2.3.0)
12
10
  builder (3.2.2)
13
- coveralls (0.8.10)
14
- json (~> 1.8)
15
- rest-client (>= 1.6.8, < 2)
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 (~> 1.6.0)
20
- cucumber (2.1.0)
16
+ tins (>= 1.6.0, < 2)
17
+ cucumber (2.4.0)
21
18
  builder (>= 2.1.2)
22
- cucumber-core (~> 1.3.0)
19
+ cucumber-core (~> 1.5.0)
20
+ cucumber-wire (~> 0.0.1)
23
21
  diff-lcs (>= 1.1.3)
24
- gherkin3 (~> 3.1.0)
22
+ gherkin (~> 4.0)
25
23
  multi_json (>= 1.7.5, < 2.0)
26
24
  multi_test (>= 0.1.2)
27
- cucumber-core (1.3.1)
28
- gherkin3 (~> 3.1.0)
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
- domain_name (0.5.25)
32
- unf (>= 0.0.5, < 1.0.0)
33
- gherkin3 (3.1.2)
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
- netrc (0.11.0)
41
- parser (2.2.3.0)
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.0.0)
45
- rake (10.4.2)
46
- rest-client (1.8.0)
47
- http-cookie (>= 1.0.2, < 2.0)
48
- mime-types (>= 1.16, < 3.0)
49
- netrc (~> 0.7)
50
- rspec (3.4.0)
51
- rspec-core (~> 3.4.0)
52
- rspec-expectations (~> 3.4.0)
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.4.0)
59
- rspec-mocks (3.4.0)
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.4.0)
62
- rspec-support (3.4.1)
63
- rubocop (0.35.1)
64
- astrolabe (~> 1.3)
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
- tins (<= 1.6.0)
70
- ruby-progressbar (1.7.5)
71
- simplecov (0.11.1)
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 (~> 1.8)
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.6.0)
80
- unf (0.1.4)
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.10.6
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler'
2
4
  require 'bundler/gem_tasks'
3
5
  require 'cucumber'
data/bin/features ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bundle exec cucumber "$@"
data/bin/lint ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bundle exec rubocop
data/bin/spec ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ bundle exec rake "$@"
data/circle.yml CHANGED
@@ -1,4 +1,8 @@
1
1
  test:
2
- override:
3
- - bundle exec rake
4
2
 
3
+ pre:
4
+ - mkdir -p $CIRCLE_TEST_REPORTS/cucumber
5
+
6
+ override:
7
+ - bin/lint
8
+ - bin/features --format pretty --format json --out $CIRCLE_TEST_REPORTS/cucumber/tests.cucumber
@@ -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
- Given(/^I (?:add|ask|create|have|request) .+? "(.+?)"$/) do |code|
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if ENV['CI']
2
4
  require 'coveralls'
3
5
  Coveralls.wear!
data/lib/mortadella.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'mortadella/horizontal'
2
4
  require 'mortadella/vertical'
3
5
 
@@ -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
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Mortadella
2
4
 
3
5
  # Makes it easy to build DRY vertical Cucumber-compatible tables
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.0.0'
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.0.0
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: 2015-12-22 00:00:00.000000000 Z
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.4.5.1
150
+ rubygems_version: 2.5.1
146
151
  signing_key:
147
152
  specification_version: 4
148
153
  summary: Mock Ruby Table Delivery