knapsack 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16c44dfa2ed757dfcf1a0eb1cb207f01ec283160
4
- data.tar.gz: f78966c7d310b9e46c1c4294ff308cde1598287e
3
+ metadata.gz: 5171bf868196514551699fe2604e1ee1844920e2
4
+ data.tar.gz: 6c1fd98385306d4fdc80a806c325c54ffd470d0b
5
5
  SHA512:
6
- metadata.gz: 94294aa56a3788c45f09560a599a1dc8b0c6993a4c5b79155830d0c25b2d1cda2c4d6fc361f4bae8f5f40e1aa49cbad3926d4ef787f9e24c2f34fbcd9516213f
7
- data.tar.gz: d7061de09db8a6bd54d1e823aff71893016e48a8f1e4299282d6d8826d40e0e050558b1bd03c85de200ce482c62c91af0df3ad7e1e3487b9c2a1158b0ec0d682
6
+ metadata.gz: 6c62afcf1e03a56bdf8abe71b2682b969d30ca1895a4854a8533b3ed314ee188b5e37b9f066c5b9ad626f676fbb7e08a06be6697bb3b621d217f7cda4fb96dbe
7
+ data.tar.gz: 3946fb08bceb702502ded292da873c4016677aa82ac85ed958186727186ea2476db01fe7b74e6230709f67cadd579ff1a6ff59384c043dfb12cefa95dbcd93e3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.0.1
6
+
7
+ * Fix bug - Add support for Cucumber Scenario Outline.
8
+
5
9
  ### 1.0.0
6
10
 
7
11
  * Add cucumber support.
data/README.md CHANGED
@@ -37,10 +37,12 @@ Please check [changelog](CHANGELOG.md) before update gem. Knapsack follows [sema
37
37
 
38
38
  ## Installation
39
39
 
40
- Add this line to your application's Gemfile:
40
+ Add those lines to your application's Gemfile:
41
41
 
42
42
  ```ruby
43
- gem 'knapsack'
43
+ group :test, :development do
44
+ gem 'knapsack'
45
+ end
44
46
  ```
45
47
 
46
48
  And then execute:
@@ -96,11 +98,10 @@ Knapsack.logger.level = Logger::INFO
96
98
 
97
99
  ### Common step
98
100
 
99
- Add in your `Rakefile` this lines:
101
+ Add this line at the bottom of `Rakefile`:
100
102
 
101
103
  ```ruby
102
- require 'knapsack'
103
- Knapsack.load_tasks
104
+ Knapsack.load_tasks if defined?(Knapsack)
104
105
  ```
105
106
 
106
107
  Generate time execution report for your test files. Run below command on one of your CI nodes.
@@ -196,11 +197,11 @@ test:
196
197
  override:
197
198
  # Step for RSpec
198
199
  - bundle exec rake knapsack:rspec:
199
- parallel: true
200
+ parallel: true # Caution: there are 8 spaces indentation!
200
201
 
201
202
  # Step for Cucumber
202
203
  - bundle exec rake knapsack:cucumber:
203
- parallel: true
204
+ parallel: true # Caution: there are 8 spaces indentation!
204
205
  ```
205
206
 
206
207
  Now everything should works. You will get warning at the end of rspec/cucumber results if time execution will take too much.
@@ -250,9 +251,10 @@ env:
250
251
  global:
251
252
  - RAILS_ENV=test
252
253
  - MY_GLOBAL_VAR=123
254
+ - CI_NODE_TOTAL=2
253
255
  matrix:
254
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=0
255
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=1
256
+ - CI_NODE_INDEX=0
257
+ - CI_NODE_INDEX=1
256
258
  ```
257
259
 
258
260
  Such configuration will generate matrix with 2 following ENV rows:
@@ -5,8 +5,8 @@ module Knapsack
5
5
  REPORT_PATH = 'knapsack_cucumber_report.json'
6
6
 
7
7
  def bind_time_tracker
8
- Around do |scenario, block|
9
- Knapsack.tracker.test_path = scenario.file
8
+ Around do |scenario_or_outline_table, block|
9
+ Knapsack.tracker.test_path = CucumberAdapter.test_path(scenario_or_outline_table)
10
10
  Knapsack.tracker.start_timer
11
11
  block.call
12
12
  Knapsack.tracker.stop_timer
@@ -30,6 +30,14 @@ module Knapsack
30
30
  end
31
31
  end
32
32
 
33
+ def self.test_path(scenario_or_outline_table)
34
+ if scenario_or_outline_table.respond_to?(:file)
35
+ scenario_or_outline_table.file
36
+ else
37
+ scenario_or_outline_table.scenario_outline.file
38
+ end
39
+ end
40
+
33
41
  private
34
42
 
35
43
  def Around(*tag_expressions, &proc)
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -66,4 +66,24 @@ describe Knapsack::Adapters::CucumberAdapter do
66
66
  end
67
67
  end
68
68
  end
69
+
70
+ describe '.test_path' do
71
+ subject { described_class.test_path(scenario_or_outline_table) }
72
+
73
+ context 'when scenario' do
74
+ let(:scenario_file) { 'features/scenario.feature' }
75
+ let(:scenario_or_outline_table) { double(file: scenario_file) }
76
+
77
+ it { should eql scenario_file }
78
+ end
79
+
80
+ context 'when scenario outline' do
81
+ let(:scenario_outline_file) { 'features/scenario_outline.feature' }
82
+ let(:scenario_or_outline_table) do
83
+ double(scenario_outline: double(file: scenario_outline_file))
84
+ end
85
+
86
+ it { should eql scenario_outline_file }
87
+ end
88
+ end
69
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-19 00:00:00.000000000 Z
11
+ date: 2014-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler