knapsack 2.0.0 → 3.0.0

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: c222a0243faf064fbe10b0216838707da4fe45bd19800bfa8a3e3b300101a27d
4
- data.tar.gz: c42d0f4af0a1f78e6371b3c7d784195d7ea00806ff5dcd83c976645a423fdd51
3
+ metadata.gz: bf3e5a9aba000c4d624a76850d39373731918bbdcba5c1627a98131983823ff9
4
+ data.tar.gz: 524c4e365f94683bd571fbd33538aa737df1a4c44a73d66ee64d512097221c84
5
5
  SHA512:
6
- metadata.gz: d21f6ebe5063f1fae3c34ab454007b011722273f9601b50f4d24acd0fbf20ecf198ffb61f25d858503859b33b972f1aa44a28bd57538f79cdf31c968e6ccc81a
7
- data.tar.gz: 61306d11f78692150774616a577a9b5f42bbafafbdbfca6464c1dae534c8b5c6372910b69c26739763bca8a576f43564e8be7010d315ed6701c0cdc66651ef56
6
+ metadata.gz: 0a365bc8c5bc58458191e864263184307d2a8c5fb3ecfba965c22e8f78d9a322af4a14b8721456ace7729e4a50c4df2f4788acb84141910202ebf9d6794b7bf9
7
+ data.tar.gz: 82228079c42fb2c423f6085b402c7e014d99f96388b42d0d831e1e03d631bbe56980f9902eb498306a21cb67ae183dceeba43f82e94bc66c4397870ac68aa1bd
@@ -0,0 +1,117 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches: [master]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ test:
11
+
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
17
+ ruby: [2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', truffleruby-head]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
26
+
27
+ # Test for knapsack gem
28
+ - name: Run specs for Knapsack gem
29
+ run: bundle exec rspec spec
30
+
31
+ # Tests for example rspec test suite
32
+ - name: Generate knapsack report
33
+ run: KNAPSACK_GENERATE_REPORT=true bundle exec rspec --default-path spec_examples --tag focus
34
+
35
+ - name: Run specs with enabled time offset warning
36
+ run: bundle exec rspec --default-path spec_examples
37
+
38
+ - name: Run rake task for the first CI node
39
+ run: CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
40
+ - name: Run rake task for the second CI node
41
+ run: CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
42
+
43
+ - name: Check passing arguments to rspec. Run only specs with custom_focus tag (1/2)
44
+ run: KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake "knapsack:rspec[--tag custom_focus]"
45
+ - name: Check passing arguments to rspec. Run only specs with custom_focus tag (2/2)
46
+ run: KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bin/knapsack rspec "--tag custom_focus --profile"
47
+
48
+ - name: Run specs with custom knapsack logger
49
+ run: CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
50
+
51
+ - name: Run specs for custom knapsack report path
52
+ run: |
53
+ cp knapsack_rspec_report.json knapsack_custom_rspec_report.json
54
+ KNAPSACK_REPORT_PATH="knapsack_custom_rspec_report.json" KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
55
+
56
+ - name: Run specs when spec file was removed and still exists in knapsack report json
57
+ run: |
58
+ rm spec_examples/fast/1_spec.rb
59
+ KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
60
+
61
+ - name: Run specs from multiple directories with manually specified test_dir
62
+ run: KNAPSACK_TEST_DIR=spec_examples KNAPSACK_TEST_FILE_PATTERN="{spec_examples,spec_engine_examples}/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
63
+
64
+ # Tests for example minitest test suite
65
+ - name: Generate knapsack report
66
+ run: KNAPSACK_GENERATE_REPORT=true bundle exec rake test
67
+
68
+ - name: Run tests with enabled time offset warning
69
+ run: bundle exec rake test
70
+
71
+ - name: Run rake task for the first CI node
72
+ run: CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
73
+ - name: Run rake task for the second CI node
74
+ run: CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
75
+
76
+ - name: Check passing arguments to minitest. Run verbose tests
77
+ run: |
78
+ KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake "knapsack:minitest[--verbose]"
79
+ KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bin/knapsack minitest "--verbose --pride"
80
+
81
+ - name: Run tests with custom knapsack logger
82
+ run: CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
83
+
84
+ - name: Run tests for custom knapsack report path
85
+ run: |
86
+ cp knapsack_minitest_report.json knapsack_custom_minitest_report.json
87
+ KNAPSACK_REPORT_PATH="knapsack_custom_minitest_report.json" KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
88
+
89
+ - name: Run tests when test file was removed and still exists in knapsack report json
90
+ run: |
91
+ rm test_examples/fast/unit_test.rb
92
+ KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
93
+
94
+ # Tests for example spinach test suite
95
+ - name: Generate knapsack report
96
+ run: KNAPSACK_GENERATE_REPORT=true bundle exec spinach -f spinach_examples
97
+
98
+ - name: Run tests with enabled time offset warning
99
+ run: bundle exec spinach -f spinach_examples
100
+
101
+ - name: Run rake task for the first CI node
102
+ run: CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
103
+ - name: Run rake task for the second CI node
104
+ run: CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
105
+
106
+ - name: Run tests with custom knapsack logger
107
+ run: CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
108
+
109
+ - name: Run tests for custom knapsack report path
110
+ run: |
111
+ cp knapsack_spinach_report.json knapsack_custom_spinach_report.json
112
+ KNAPSACK_REPORT_PATH="knapsack_custom_spinach_report.json" KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
113
+
114
+ - name: Run tests when test file was removed and still exists in knapsack report json
115
+ run: |
116
+ rm spinach_examples/scenario1.feature
117
+ KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
data/CHANGELOG.md CHANGED
@@ -2,9 +2,25 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 3.0.0
6
+
7
+ * __(breaking change)__ Require minimum Ruby 2.2 version
8
+
9
+ https://github.com/KnapsackPro/knapsack/pull/115
10
+
11
+ * __(breaking change)__ Drop support for Minitest 4.x. Force to use minitest 5.x even on CI.
12
+
13
+ https://github.com/KnapsackPro/knapsack/pull/114
14
+
15
+ * Replace Travis CI with GitHub Actions
16
+
17
+ https://github.com/KnapsackPro/knapsack/pull/112
18
+
19
+ https://github.com/KnapsackPro/knapsack/compare/v2.0.0...v3.0.0
20
+
5
21
  ### 2.0.0
6
22
 
7
- * (breaking change) Ruby 2.1 is a minimum required version
23
+ * __(breaking change)__ Ruby 2.1 is a minimum required version
8
24
 
9
25
  https://github.com/KnapsackPro/knapsack/pull/113
10
26
 
data/knapsack.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.required_ruby_version = '>= 2.1'
21
+ spec.required_ruby_version = '>= 2.2'
22
22
 
23
23
  spec.add_dependency 'rake', '>= 0'
24
24
 
@@ -23,20 +23,20 @@ module Knapsack
23
23
  def bind_time_tracker
24
24
  ::Minitest::Test.send(:include, BindTimeTrackerMinitestPlugin)
25
25
 
26
- add_post_run_callback do
26
+ Minitest.after_run do
27
27
  Knapsack.logger.info(Presenter.global_time)
28
28
  end
29
29
  end
30
30
 
31
31
  def bind_report_generator
32
- add_post_run_callback do
32
+ Minitest.after_run do
33
33
  Knapsack.report.save
34
34
  Knapsack.logger.info(Presenter.report_details)
35
35
  end
36
36
  end
37
37
 
38
38
  def bind_time_offset_warning
39
- add_post_run_callback do
39
+ Minitest.after_run do
40
40
  Knapsack.logger.log(
41
41
  Presenter.time_offset_log_level,
42
42
  Presenter.time_offset_warning
@@ -64,16 +64,6 @@ module Knapsack
64
64
  # test_path will look like ./test/dir/unit_test.rb
65
65
  test_path
66
66
  end
67
-
68
- private
69
-
70
- def add_post_run_callback(&block)
71
- if Minitest.respond_to?(:after_run)
72
- Minitest.after_run { block.call }
73
- else
74
- Minitest::Unit.after_tests { block.call }
75
- end
76
- end
77
67
  end
78
68
  end
79
69
  end
@@ -1,3 +1,3 @@
1
1
  module Knapsack
2
- VERSION = '2.0.0'
2
+ VERSION = '3.0.0'
3
3
  end
@@ -16,10 +16,22 @@ describe FakeCalculator do
16
16
  end
17
17
 
18
18
  it '#add' do
19
- @calc.add(2, 3).must_equal 5
19
+ result = @calc.add(2, 3)
20
+
21
+ if self.respond_to?(:_)
22
+ _(result).must_equal 5
23
+ else
24
+ result.must_equal 5
25
+ end
20
26
  end
21
27
 
22
28
  it '#mal' do
23
- @calc.mal(2, 3).must_equal 6
29
+ result = @calc.mal(2, 3)
30
+
31
+ if self.respond_to?(:_)
32
+ _(result).must_equal 6
33
+ else
34
+ result.must_equal 6
35
+ end
24
36
  end
25
37
  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: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ArturT
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-21 00:00:00.000000000 Z
11
+ date: 2021-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -149,20 +149,18 @@ email:
149
149
  - arturtrzop@gmail.com
150
150
  executables:
151
151
  - knapsack
152
- - print_header.sh
153
152
  extensions: []
154
153
  extra_rdoc_files: []
155
154
  files:
155
+ - ".github/workflows/ruby.yml"
156
156
  - ".gitignore"
157
157
  - ".rspec"
158
- - ".travis.yml"
159
158
  - CHANGELOG.md
160
159
  - Gemfile
161
160
  - LICENSE.txt
162
161
  - README.md
163
162
  - Rakefile
164
163
  - bin/knapsack
165
- - bin/print_header.sh
166
164
  - docs/images/logos/knapsack-@2.png
167
165
  - docs/images/logos/knapsack-big.png
168
166
  - docs/images/logos/knapsack-logo-@2.png
@@ -264,7 +262,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
264
262
  requirements:
265
263
  - - ">="
266
264
  - !ruby/object:Gem::Version
267
- version: '2.1'
265
+ version: '2.2'
268
266
  required_rubygems_version: !ruby/object:Gem::Requirement
269
267
  requirements:
270
268
  - - ">="
data/.travis.yml DELETED
@@ -1,116 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- rvm:
5
- - 2.1
6
- - 2.2
7
- - 2.3
8
- - 2.4
9
- - 2.5
10
- - 2.6
11
- - 2.7
12
- - 3.0
13
- - truffleruby-head
14
- addons:
15
- code_climate:
16
- repo_token: 38686058eed480dd0fcf8bce9015733e0bae88e44e30f4a1ac63df8aec2f86d8
17
- before_install:
18
- - "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
19
- script:
20
- # Test for knapsack gem
21
- - bin/print_header.sh "Run specs for Knapsack gem"
22
- - bundle exec rspec spec
23
-
24
-
25
- - bin/print_header.sh "------------------------------------------------------"
26
-
27
-
28
- # Tests for example rspec test suite
29
- - bin/print_header.sh "Generate knapsack report"
30
- - KNAPSACK_GENERATE_REPORT=true bundle exec rspec --default-path spec_examples --tag focus
31
-
32
- - bin/print_header.sh "Run specs with enabled time offset warning"
33
- - bundle exec rspec --default-path spec_examples
34
-
35
- - bin/print_header.sh "Run rake task for the first CI node"
36
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
37
- - bin/print_header.sh "Run rake task for the second CI node"
38
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
39
-
40
- - bin/print_header.sh "Check passing arguments to rspec. Run only specs with custom_focus tag"
41
- - KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake "knapsack:rspec[--tag custom_focus]"
42
- - KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bin/knapsack rspec "--tag custom_focus --profile"
43
-
44
- - bin/print_header.sh "Run specs with custom knapsack logger"
45
- - CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
46
-
47
- - bin/print_header.sh "Run specs for custom knapsack report path"
48
- - cp knapsack_rspec_report.json knapsack_custom_rspec_report.json
49
- - KNAPSACK_REPORT_PATH="knapsack_custom_rspec_report.json" KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
50
-
51
- - bin/print_header.sh "Run specs when spec file was removed and still exists in knapsack report json"
52
- - rm spec_examples/fast/1_spec.rb
53
- - KNAPSACK_TEST_FILE_PATTERN="spec_examples/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
54
-
55
- - bin/print_header.sh "Run specs from multiple directories with manually specified test_dir"
56
- - KNAPSACK_TEST_DIR=spec_examples KNAPSACK_TEST_FILE_PATTERN="{spec_examples,spec_engine_examples}/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
57
-
58
-
59
- - bin/print_header.sh "------------------------------------------------------"
60
-
61
-
62
- # Tests for example minitest test suite
63
- - bin/print_header.sh "Generate knapsack report"
64
- - KNAPSACK_GENERATE_REPORT=true bundle exec rake test
65
-
66
- - bin/print_header.sh "Run tests with enabled time offset warning"
67
- - bundle exec rake test
68
-
69
- - bin/print_header.sh "Run rake task for the first CI node"
70
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
71
- - bin/print_header.sh "Run rake task for the second CI node"
72
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
73
-
74
- - bin/print_header.sh "Check passing arguments to minitest. Run verbose tests"
75
- - KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake "knapsack:minitest[--verbose]"
76
- - KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bin/knapsack minitest "--verbose --pride"
77
-
78
- - bin/print_header.sh "Run tests with custom knapsack logger"
79
- - CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
80
-
81
- - bin/print_header.sh "Run tests for custom knapsack report path"
82
- - cp knapsack_minitest_report.json knapsack_custom_minitest_report.json
83
- - KNAPSACK_REPORT_PATH="knapsack_custom_minitest_report.json" KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
84
-
85
- - bin/print_header.sh "Run tests when test file was removed and still exists in knapsack report json"
86
- - rm test_examples/fast/unit_test.rb
87
- - KNAPSACK_TEST_FILE_PATTERN="test_examples/**{,/*/**}/*_test.rb" bundle exec rake knapsack:minitest
88
-
89
-
90
- - bin/print_header.sh "------------------------------------------------------"
91
-
92
-
93
- # Tests for example spinach test suite
94
- - bin/print_header.sh "Generate knapsack report"
95
- - KNAPSACK_GENERATE_REPORT=true bundle exec spinach -f spinach_examples
96
-
97
- - bin/print_header.sh "Run tests with enabled time offset warning"
98
- - bundle exec spinach -f spinach_examples
99
-
100
- - bin/print_header.sh "Run rake task for the first CI node"
101
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
102
- - bin/print_header.sh "Run rake task for the second CI node"
103
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
104
-
105
- - bin/print_header.sh "Run tests with custom knapsack logger"
106
- - CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
107
-
108
- - bin/print_header.sh "Run tests for custom knapsack report path"
109
- - cp knapsack_spinach_report.json knapsack_custom_spinach_report.json
110
- - KNAPSACK_REPORT_PATH="knapsack_custom_spinach_report.json" KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
111
-
112
- - bin/print_header.sh "Run tests when test file was removed and still exists in knapsack report json"
113
- - rm spinach_examples/scenario1.feature
114
- - KNAPSACK_TEST_FILE_PATTERN="spinach_examples/**{,/*/**}/*.feature" bundle exec rake "knapsack:spinach[-f spinach_examples]"
115
- notifications:
116
- email: false
data/bin/print_header.sh DELETED
@@ -1,5 +0,0 @@
1
- #!/bin/bash
2
-
3
- echo ==========================================================================================================================
4
- echo $1
5
- echo ==========================================================================================================================