knapsack_pro 7.6.0 → 7.6.2

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
  SHA256:
3
- metadata.gz: 4c20774d9ffe521fc4a3a137558b47c79cc27b085e96f2b00d3a61711e43f0c9
4
- data.tar.gz: af712f88ca12cf15de791d3b755fc75d6a527e938034d835ddaa0e07b77a5fd2
3
+ metadata.gz: 1fd5c8d52aa9de26d125b40b1c3b60ee7536a75e9351b524ad9d99386fd6bfc8
4
+ data.tar.gz: 491d49252b139b817939ef4555a36fba6ca6ca74cc70e9a325124e0a900bb5ab
5
5
  SHA512:
6
- metadata.gz: ad574926a94e992932fbc8538d15040535624631c22f3679ca3c39d4d304f2e87b0efa30c536eb2695698b419b3f9e58708f1e4e5afc83d6df565e4eae6c3e7b
7
- data.tar.gz: 21365b7b89c96193c3ad9ae45657d6916760745b584f1552a7e85ac686b2de6e12d6b7203c8847e2cd09997b456462f742490cc4d140d42cf135ddbd5cc23865
6
+ metadata.gz: f1b030ead892b4251f9e191049425675105940777e5061a81e23b90ce8481e3a0564832068202d56d912afe62e5e92482a771f06e7c3faeaf331dc5d772a583c
7
+ data.tar.gz: 82f5ba33b17213da4b7a7b8e2647042559b52ac12c0aae7255f838ed4e6ed70d0fab80d7009434855e58c1c63d3c11fb9cfe69f85fab5968fa37edc3005d1250
data/.circleci/config.yml CHANGED
@@ -165,6 +165,18 @@ jobs:
165
165
  export KNAPSACK_PRO_ENDPOINT=https://api-fake.knapsackpro.com
166
166
  export KNAPSACK_PRO_MAX_REQUEST_RETRIES=1
167
167
  bundle exec rake knapsack_pro:rspec
168
+ - run:
169
+ working_directory: ~/rails-app-with-knapsack_pro
170
+ command: |
171
+ # ensures KnapsackPro::Formatters::TimeTracker works when the .rspec file does not exist
172
+ export KNAPSACK_PRO_BRANCH="$CIRCLE_BRANCH--$CIRCLE_BUILD_NUM--regular--no-dot-rspec-file"
173
+ mv .rspec .rspec.off
174
+ # load test files that require spec_helper explicitly
175
+ export KNAPSACK_PRO_TEST_FILE_PATTERN="{spec/time_tracker_spec.rb}"
176
+ bundle exec rake knapsack_pro:rspec
177
+ RSPEC_EXIT_CODE=$?
178
+ mv .rspec.off .rspec
179
+ exit $RSPEC_EXIT_CODE
168
180
  - run:
169
181
  working_directory: ~/rails-app-with-knapsack_pro
170
182
  command: |
data/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  ### UNRELEASED
4
4
 
5
+ ### 7.6.2
6
+
7
+ * Fix an error for the `KnapsackPro::Formatters::TimeTracker` formatter in RSpec when using Knapsack Pro Regular Mode and the `.rspec` file is not present.
8
+
9
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/265
10
+
11
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v7.6.1...v7.6.2
12
+
13
+ ### 7.6.1
14
+
15
+ * Add support for the Timecop 0.9.9 gem version so that we could track proper tests' execution time when `Process.clock_gettime` is mocked.
16
+
17
+ https://github.com/KnapsackPro/knapsack_pro-ruby/pull/262
18
+
19
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v7.6.0...v7.6.1
20
+
5
21
  ### 7.6.0
6
22
 
7
23
  * Avoid starting an unnecessary process in Queue Mode.
data/README.md CHANGED
@@ -78,7 +78,7 @@ Scripted tests can be found in the [Rails App With Knapsack Pro repository](http
78
78
 
79
79
  2. Update the gem version in `lib/knapsack_pro/version.rb`
80
80
 
81
- 3. `git commit -am "chore: prepare release"`
81
+ 3. `git commit -am "Bump version x.x.x"`
82
82
 
83
83
  4. Build, tag, push, release: `bundle exec rake release`
84
84
 
data/knapsack_pro.gemspec CHANGED
@@ -38,5 +38,5 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency 'pry', '~> 0'
39
39
  spec.add_development_dependency 'vcr', '>= 6.0'
40
40
  spec.add_development_dependency 'webmock', '>= 3.13'
41
- spec.add_development_dependency 'timecop', '>= 0.9.4'
41
+ spec.add_development_dependency 'timecop', '>= 0.9.9'
42
42
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'stringio'
4
+ require_relative '../utils'
4
5
 
5
6
  module KnapsackPro
6
7
  module Formatters
@@ -145,7 +146,7 @@ module KnapsackPro
145
146
  end
146
147
 
147
148
  def now
148
- Process.clock_gettime(Process::CLOCK_MONOTONIC)
149
+ KnapsackPro::Utils.time_now
149
150
  end
150
151
  end
151
152
  end
@@ -155,7 +155,7 @@ module KnapsackPro
155
155
  end
156
156
 
157
157
  def now_without_mock_time
158
- Process.clock_gettime(Process::CLOCK_MONOTONIC)
158
+ KnapsackPro::Utils.time_now
159
159
  end
160
160
  end
161
161
  end
@@ -5,5 +5,13 @@ module KnapsackPro
5
5
  def self.unsymbolize(obj)
6
6
  JSON.parse(obj.to_json)
7
7
  end
8
+
9
+ def self.time_now
10
+ if defined?(Timecop) && Process.respond_to?(:clock_gettime_without_mock)
11
+ Process.clock_gettime_without_mock(Process::CLOCK_MONOTONIC)
12
+ else
13
+ Process.clock_gettime(Process::CLOCK_MONOTONIC)
14
+ end
15
+ end
8
16
  end
9
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KnapsackPro
4
- VERSION = '7.6.0'
4
+ VERSION = '7.6.2'
5
5
  end
@@ -16,4 +16,40 @@ describe KnapsackPro::Utils do
16
16
  ])
17
17
  end
18
18
  end
19
+
20
+ describe '.time_now' do
21
+ subject { described_class.time_now }
22
+
23
+ context 'when Timecop does not mock the time' do
24
+ it do
25
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
26
+ expect(subject).to be_within(0.001).of(now)
27
+ end
28
+ end
29
+
30
+ context 'when Timecop does mock the process clock' do
31
+ around(:example) do |ex|
32
+ unless Gem::Version.new(Timecop::VERSION) >= Gem::Version.new('0.9.9')
33
+ raise 'Timecop >= 0.9.9 is required to run this test. Please run: bundle update'
34
+ end
35
+
36
+ if Gem::Version.new(Timecop::VERSION) >= Gem::Version.new('0.9.10')
37
+ Timecop.mock_process_clock = true
38
+ ex.run
39
+ Timecop.mock_process_clock = false
40
+ else
41
+ ex.run
42
+ end
43
+ end
44
+
45
+ it do
46
+ now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
47
+
48
+ time = Time.local(2020, 1, 31)
49
+ Timecop.travel(time) do
50
+ expect(subject).to be_within(0.001).of(now)
51
+ end
52
+ end
53
+ end
54
+ end
19
55
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knapsack_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.6.0
4
+ version: 7.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-12 00:00:00.000000000 Z
11
+ date: 2024-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -170,14 +170,14 @@ dependencies:
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: 0.9.4
173
+ version: 0.9.9
174
174
  type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: 0.9.4
180
+ version: 0.9.9
181
181
  description: Knapsack Pro wraps your current test runner(s) and works with your existing
182
182
  CI infrastructure to parallelize tests optimally. It dynamically splits your tests
183
183
  based on up-to-date test execution data. It's designed from the ground up for CI