knapsack 1.0.3 → 1.0.4

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: 7c687c34dd940bdf5c7594c114be9332548944ff
4
- data.tar.gz: 38a10eaa09e1b6b87d4110a5c6173997f6dd73f2
3
+ metadata.gz: e248debc4bc1dd04e46fe1be7ed75a54d245b782
4
+ data.tar.gz: 084848b68ebf859224d460bc74684cbc4d3b5c98
5
5
  SHA512:
6
- metadata.gz: 4f4784ef9d81e7b1110269a1b280fdc7fd9b4ce8c16c08612c91a6524754d4e1c35a9fe88512b7d5512d03c26423bd70d2bea7eea15949b06d7eebb728800077
7
- data.tar.gz: 6121b44a1c65b71d0a3c44478889cdfd80104448defcefe1b65f0a294b03fb38d6cfb4742e759bc4162ca71d8e54c25375fcb1578a224c87f527d05b7f831cb3
6
+ metadata.gz: 2acdbf01e8c49ac212a82013a8a6295b891d69b557960f40a0f5152bf0d5d7cfea06e748a7e318e54588f40c196b003c6f51208d3f79a032675075e2cc69cddb
7
+ data.tar.gz: 0048c16e8d0bcf0ee4d1333f25e8f346b95f76ea7eab9b182d7599c20943172fdd2e25123b3912284212df3031f128d853785e845809779760cc928e0ea3438d
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.0.4
6
+
7
+ * Pull request #12 - Raise error when CI_NODE_INDEX >= CI_NODE_TOTAL
8
+
9
+ https://github.com/ArturT/knapsack/pull/12
10
+
5
11
  ### 1.0.3
6
12
 
7
13
  * Fix bug #11 - Track properly time when using Timecop gem in tests.
@@ -8,6 +8,10 @@ module Knapsack
8
8
  @test_file_pattern = args[:test_file_pattern] || raise('Missing test_file_pattern')
9
9
  @ci_node_total = args[:ci_node_total] || raise('Missing ci_node_total')
10
10
  @ci_node_index = args[:ci_node_index] || raise('Missing ci_node_index')
11
+
12
+ if ci_node_index >= ci_node_total
13
+ raise("Node indexes are 0-based. Can't be higher or equal to the total number of nodes.")
14
+ end
11
15
  end
12
16
 
13
17
  def ci_node_total
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
@@ -49,6 +49,22 @@ describe Knapsack::Distributors::BaseDistributor do
49
49
  let(:custom_args) { { ci_node_index: nil } }
50
50
  it { expect { subject }.to raise_error('Missing ci_node_index') }
51
51
  end
52
+
53
+ context 'when ci_node_index has not allowed value' do
54
+ let(:expected_exception_message) do
55
+ "Node indexes are 0-based. Can't be higher or equal to the total number of nodes."
56
+ end
57
+
58
+ context 'when ci_node_index is equal to ci_node_total' do
59
+ let(:custom_args) { { ci_node_index: 1, ci_node_total: 1 } }
60
+ it { expect { subject }.to raise_error(expected_exception_message) }
61
+ end
62
+
63
+ context 'when ci_node_index is higher than ci_node_total' do
64
+ let(:custom_args) { { ci_node_index: 2, ci_node_total: 1 } }
65
+ it { expect { subject }.to raise_error(expected_exception_message) }
66
+ end
67
+ end
52
68
  end
53
69
 
54
70
  describe '#tests_for_current_node' do
@@ -161,7 +161,7 @@ describe Knapsack::Tracker do
161
161
  end
162
162
  end
163
163
 
164
- it { expect(tracker.global_time).to be >= 0 }
164
+ it { expect(tracker.global_time).to be > 0 }
165
165
  it { expect(tracker.global_time).to be_within(delta).of(0) }
166
166
  it { expect(tracker.test_files_with_time.keys.size).to eql 2 }
167
167
  it { expect(tracker.test_files_with_time['a_spec.rb']).to be_within(delta).of(0) }
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.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler