knapsack 1.4.0 → 1.4.1

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: 8319351a256487728d985749b72592013e4300db
4
- data.tar.gz: 685600b211177aa493dc3d607067d8553eb248f2
3
+ metadata.gz: 6ac6199bd640d975d725e7fc00509f1785a4fa2e
4
+ data.tar.gz: 1af90f4bff6a1077051e248459f82a9a8a1a3f7c
5
5
  SHA512:
6
- metadata.gz: 2e17a9f6638b01ff7c94df361a29be64a5ae9b7402bdf7bfe108b3f3531d3f6be80a081d3c2eb50c5ad24bdb89ba479b4e73f055e4a8ca2316ba66e39c646800
7
- data.tar.gz: 51de58b779209637241afe7dbb131412073bd77be4a66cfaccccd0a68407dd29a938fab9ba2a3d8497d6ee25c1f675b15c9ee7d9703b02828407ebf76939741e
6
+ metadata.gz: fe02e1a38bc1d34404dc0ddaeb9808924614ba7293a5bf9c3fe5486cf2afba012301b9e4a2fd2be1d3de585ad88331196e6e4246d841e6615a92d7a45ea035f6
7
+ data.tar.gz: eb874f176692f3d4199bbf79ca2f2ac42444698840ea7ec8f2a78e840bf1f843816cc8106d1cd59a294db739d0fef2a35a6e803d460377508485456fa13f3423
data/.travis.yml CHANGED
@@ -29,24 +29,24 @@ script:
29
29
  - bundle exec rspec --default-path spec_examples
30
30
 
31
31
  - bin/print_header.sh "Run rake task for the first CI node"
32
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
32
+ - CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
33
33
  - bin/print_header.sh "Run rake task for the second CI node"
34
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
34
+ - CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
35
35
 
36
36
  - bin/print_header.sh "Check passing arguments to rspec. Run only specs with custom_focus tag"
37
- - KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake "knapsack:rspec[--tag custom_focus]"
38
- - KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bin/knapsack rspec "--tag custom_focus --profile"
37
+ - KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake "knapsack:rspec[--tag custom_focus]"
38
+ - KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bin/knapsack rspec "--tag custom_focus --profile"
39
39
 
40
40
  - bin/print_header.sh "Run specs with custom knapsack logger"
41
- - CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
41
+ - CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
42
42
 
43
43
  - bin/print_header.sh "Run specs for custom knapsack report path"
44
44
  - cp knapsack_rspec_report.json knapsack_custom_rspec_report.json
45
- - KNAPSACK_REPORT_PATH="knapsack_custom_rspec_report.json" KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
45
+ - KNAPSACK_REPORT_PATH="knapsack_custom_rspec_report.json" KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
46
46
 
47
47
  - bin/print_header.sh "Run specs when spec file was removed and still exists in knapsack report json"
48
48
  - rm spec_examples/fast/1_spec.rb
49
- - KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
49
+ - KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
50
50
 
51
51
 
52
52
  - bin/print_header.sh "------------------------------------------------------"
@@ -60,23 +60,23 @@ script:
60
60
  - bundle exec rake test
61
61
 
62
62
  - bin/print_header.sh "Run rake task for the first CI node"
63
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="test_examples/**/*_test.rb" bundle exec rake knapsack:minitest
63
+ - CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
64
64
  - bin/print_header.sh "Run rake task for the second CI node"
65
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="test_examples/**/*_test.rb" bundle exec rake knapsack:minitest
65
+ - CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
66
66
 
67
67
  - bin/print_header.sh "Check passing arguments to minitest. Run verbose tests"
68
- - KNAPSACK_TEST_FILE_PATTERN="test_examples/**/*_test.rb" bundle exec rake "knapsack:minitest[--verbose]"
69
- - KNAPSACK_TEST_FILE_PATTERN="test_examples/**/*_test.rb" bin/knapsack minitest "--verbose --pride"
68
+ - KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake "knapsack:minitest[--verbose]"
69
+ - KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bin/knapsack minitest "--verbose --pride"
70
70
 
71
71
  - bin/print_header.sh "Run tests with custom knapsack logger"
72
- - CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="test_examples/**/*_test.rb" bundle exec rake knapsack:minitest
72
+ - CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
73
73
 
74
74
  - bin/print_header.sh "Run tests for custom knapsack report path"
75
75
  - cp knapsack_minitest_report.json knapsack_custom_minitest_report.json
76
- - KNAPSACK_REPORT_PATH="knapsack_custom_minitest_report.json" KNAPSACK_TEST_FILE_PATTERN="test_examples/**/*_test.rb" bundle exec rake knapsack:minitest
76
+ - KNAPSACK_REPORT_PATH="knapsack_custom_minitest_report.json" KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
77
77
 
78
78
  - bin/print_header.sh "Run tests when test file was removed and still exists in knapsack report json"
79
79
  - rm test_examples/fast/unit_test.rb
80
- - KNAPSACK_TEST_FILE_PATTERN="test_examples/**/*_test.rb" bundle exec rake knapsack:minitest
80
+ - KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
81
81
  notifications:
82
82
  email: false
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.4.1
6
+
7
+ * Update test file pattern in tests also. Related PR https://github.com/ArturT/knapsack/pull/27
8
+ * Ensure there are no duplicates in leftover tests because of new test file pattern
9
+
10
+ https://github.com/ArturT/knapsack/compare/v1.4.0...v1.4.1
11
+
5
12
  ### 1.4.0
6
13
 
7
14
  * Rename RspecAdapter to RSpecAdapter so that it is consistent
data/README.md CHANGED
@@ -146,7 +146,7 @@ Knapsack.tracker.config({
146
146
  })
147
147
 
148
148
  Knapsack.report.config({
149
- test_file_pattern: 'spec/**/*_spec.rb', # default value based on adapter
149
+ test_file_pattern: 'spec/**{,/*/**}/*_spec.rb', # default value based on adapter
150
150
  report_path: 'knapsack_custom_report.json'
151
151
  })
152
152
 
@@ -205,13 +205,13 @@ On your CI server run this command for the first CI node. Update `CI_NODE_INDEX`
205
205
  You can add `KNAPSACK_TEST_FILE_PATTERN` if your tests are not in default directory. For instance:
206
206
 
207
207
  # Step for RSpec
208
- $ KNAPSACK_TEST_FILE_PATTERN="directory_with_specs/**/*_spec.rb" CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:rspec
208
+ $ KNAPSACK_TEST_FILE_PATTERN="directory_with_specs/**{,/*/**}/*_spec.rb" CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:rspec
209
209
 
210
210
  # Step for Cucumber
211
211
  $ KNAPSACK_TEST_FILE_PATTERN="directory_with_features/**/*.feature" CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:cucumber
212
212
 
213
213
  # Step for Minitest
214
- $ KNAPSACK_TEST_FILE_PATTERN="directory_with_tests/**/*_test.rb" CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:minitest
214
+ $ KNAPSACK_TEST_FILE_PATTERN="directory_with_tests/**{,/*/**}/*_spec.rb" CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:minitest
215
215
 
216
216
  You can set `KNAPSACK_REPORT_PATH` if your knapsack report was saved in non default location. Example:
217
217
 
@@ -476,7 +476,7 @@ To generate a new knapsack report for specs with `focus` tag (only specs in `spe
476
476
 
477
477
  To see specs distributed for the first CI node type:
478
478
 
479
- $ CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_SPEC_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
479
+ $ CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_SPEC_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
480
480
 
481
481
  Specs in `spec_examples/leftover` take more than 3 seconds. This should cause a Knapsack time offset warning because we set `time_offset_in_seconds` to 3 in `spec_examples/spec_helper.rb`. Type below to see warning:
482
482
 
data/Rakefile CHANGED
@@ -6,5 +6,5 @@ Knapsack.load_tasks
6
6
 
7
7
  Rake::TestTask.new(:test) do |t|
8
8
  t.libs << 'test_examples'
9
- t.pattern = 'test_examples/**/*_test.rb'
9
+ t.pattern = 'test_examples/**{,/*/**}/*_test.rb'
10
10
  end
data/knapsack.gemspec CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.6'
25
25
  spec.add_development_dependency 'rspec', '~> 3.0', '>= 2.0.0'
26
+ spec.add_development_dependency 'rspec-its', '~> 1.2'
26
27
  spec.add_development_dependency 'cucumber', '>= 1.3'
27
28
  spec.add_development_dependency 'minitest', '>= 5.0.0'
28
29
  spec.add_development_dependency 'codeclimate-test-reporter', '~> 0'
@@ -55,7 +55,7 @@ module Knapsack
55
55
  end
56
56
  end
57
57
 
58
- # This is added to provide backwards compatabiliy
58
+ # This is added to provide backwards compatibility
59
59
  class RspecAdapter < RSpecAdapter
60
60
  end
61
61
  end
@@ -37,7 +37,7 @@ module Knapsack
37
37
  end
38
38
 
39
39
  def all_tests
40
- @all_tests ||= Dir[test_file_pattern].sort
40
+ @all_tests ||= Dir.glob(test_file_pattern).uniq.sort
41
41
  end
42
42
 
43
43
  protected
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '1.4.0'
2
+ VERSION = '1.4.1'
3
3
  end
@@ -60,7 +60,7 @@ describe Knapsack::AllocatorBuilder do
60
60
  end
61
61
 
62
62
  context 'when ENV test_file_pattern has value' do
63
- let(:env_test_file_pattern) { 'custom_spec/**/*_spec.rb' }
63
+ let(:env_test_file_pattern) { 'custom_spec/**{,/*/**}/*_spec.rb' }
64
64
  let(:report_config) { { report_path: adapter_report_path } }
65
65
  let(:allocator_args) do
66
66
  {
@@ -102,7 +102,7 @@ describe Knapsack::AllocatorBuilder do
102
102
  end
103
103
 
104
104
  context 'when ENV test_file_pattern has value' do
105
- let(:env_test_file_pattern) { 'custom_spec/**/*_spec.rb' }
105
+ let(:env_test_file_pattern) { 'custom_spec/**{,/*/**}/*_spec.rb' }
106
106
 
107
107
  it { should eq 'custom_spec' }
108
108
  end
@@ -43,7 +43,7 @@ describe Knapsack::Allocator do
43
43
  end
44
44
 
45
45
  describe '#test_dir' do
46
- let(:test_file_pattern) { "test_dir/**/*_spec.rb" }
46
+ let(:test_file_pattern) { "test_dir/**{,/*/**}/*_spec.rb" }
47
47
 
48
48
  subject { allocator.test_dir }
49
49
 
@@ -77,7 +77,7 @@ describe Knapsack::Config::Env do
77
77
  subject { described_class.test_file_pattern }
78
78
 
79
79
  context 'when ENV exists' do
80
- let(:test_file_pattern) { 'custom_spec/**/*_spec.rb' }
80
+ let(:test_file_pattern) { 'custom_spec/**{,/*/**}/*_spec.rb' }
81
81
  before { stub_const("ENV", { 'KNAPSACK_TEST_FILE_PATTERN' => test_file_pattern }) }
82
82
  it { should eql test_file_pattern }
83
83
  end
@@ -3,7 +3,7 @@ describe Knapsack::Distributors::BaseDistributor do
3
3
  let(:default_args) do
4
4
  {
5
5
  report: report,
6
- test_file_pattern: 'spec/**/*_spec.rb',
6
+ test_file_pattern: 'spec/**{,/*/**}/*_spec.rb',
7
7
  ci_node_total: '1',
8
8
  ci_node_index: '0'
9
9
  }
@@ -7,7 +7,7 @@ describe Knapsack::Distributors::LeftoverDistributor do
7
7
  'd_spec.rb' => 2.5,
8
8
  }
9
9
  end
10
- let(:test_file_pattern) { 'spec/**/*_spec.rb' }
10
+ let(:test_file_pattern) { 'spec/**{,/*/**}/*_spec.rb' }
11
11
  let(:default_args) do
12
12
  {
13
13
  report: report,
@@ -29,18 +29,26 @@ describe Knapsack::Distributors::LeftoverDistributor do
29
29
  subject { distributor.all_tests }
30
30
 
31
31
  context 'when given test_file_pattern' do
32
- context 'spec/**/*_spec.rb' do
32
+ context 'spec/**{,/*/**}/*_spec.rb' do
33
33
  it { should_not be_empty }
34
34
  it { should include 'spec/knapsack/tracker_spec.rb' }
35
35
  it { should include 'spec/knapsack/adapters/rspec_adapter_spec.rb' }
36
+
37
+ it 'has no duplicated test file paths' do
38
+ expect(subject.size).to eq subject.uniq.size
39
+ end
36
40
  end
37
41
 
38
- context 'spec_examples/**/*_spec.rb' do
39
- let(:test_file_pattern) { 'spec_examples/**/*_spec.rb' }
42
+ context 'spec_examples/**{,/*/**}/*_spec.rb' do
43
+ let(:test_file_pattern) { 'spec_examples/**{,/*/**}/*_spec.rb' }
40
44
 
41
45
  it { should_not be_empty }
42
46
  it { should include 'spec_examples/fast/1_spec.rb' }
43
47
  it { should include 'spec_examples/leftover/a_spec.rb' }
48
+
49
+ it 'has no duplicated test file paths' do
50
+ expect(subject.size).to eq subject.uniq.size
51
+ end
44
52
  end
45
53
  end
46
54
 
@@ -3,7 +3,7 @@ describe Knapsack::Distributors::ReportDistributor do
3
3
  let(:default_args) do
4
4
  {
5
5
  report: report,
6
- test_file_pattern: 'spec/**/*_spec.rb',
6
+ test_file_pattern: 'spec/**{,/*/**}/*_spec.rb',
7
7
  ci_node_total: '1',
8
8
  ci_node_index: '0'
9
9
  }
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'rspec/its'
2
+
1
3
  require 'timecop'
2
4
  Timecop.safe_mode = true
3
5
 
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.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-03 00:00:00.000000000 Z
11
+ date: 2015-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -72,6 +72,20 @@ dependencies:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: 2.0.0
75
+ - !ruby/object:Gem::Dependency
76
+ name: rspec-its
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.2'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.2'
75
89
  - !ruby/object:Gem::Dependency
76
90
  name: cucumber
77
91
  requirement: !ruby/object:Gem::Requirement