knapsack 1.12.2 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +19 -0
- data/lib/knapsack.rb +1 -1
- data/lib/knapsack/config/env.rb +8 -0
- data/lib/knapsack/version.rb +1 -1
- data/spec/knapsack/config/env_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc507dcb2e7669f4a09a839eb62763c1b843f6a8
|
4
|
+
data.tar.gz: 77b634384eed15ed5cceb2edb2257f083c18f58d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a12fdfdf2e8021c38fcc6929f099edb62614c46faa54c21b181f90416fa8cba65078a4cbb9f5d5b4319979e2a49ba707f6567bda22d63f5b642c402d62300c3
|
7
|
+
data.tar.gz: 15ac64348c0cf24847482d74ae368ad9f56117dbb881866f63811dbbfe1f7dceb8ae147bf7df96f4b63256a99eaa90823cd61a3de22e0341a744b9b73ba06cab
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -92,6 +92,7 @@ The knapsack gem supports:
|
|
92
92
|
- [How can I run tests from multiple directories?](#how-can-i-run-tests-from-multiple-directories)
|
93
93
|
- [How to update existing knapsack report for a few test files?](#how-to-update-existing-knapsack-report-for-a-few-test-files)
|
94
94
|
- [How to run tests for particular CI node in your development environment](#how-to-run-tests-for-particular-ci-node-in-your-development-environment)
|
95
|
+
- [How can I change log level?](#how-can-i-change-log-level)
|
95
96
|
- [Gem tests](#gem-tests)
|
96
97
|
- [Spec](#spec)
|
97
98
|
- [Spec examples](#spec-examples)
|
@@ -633,6 +634,16 @@ The test file pattern config option supports any glob pattern handled by [`Dir.g
|
|
633
634
|
|
634
635
|
$ KNAPSACK_TEST_DIR=spec KNAPSACK_TEST_FILE_PATTERN="{spec,engines/**/spec}/**{,/*/**}/*_spec.rb" bundle exec rake knapsack:rspec
|
635
636
|
|
637
|
+
`KNAPSACK_TEST_DIR` will be your default path for rspec so you should put there your `spec_helper.rb`. Please ensure you will require it in your test files this way:
|
638
|
+
|
639
|
+
```ruby
|
640
|
+
# good
|
641
|
+
require_relative 'spec_helper'
|
642
|
+
|
643
|
+
# bad - won't work
|
644
|
+
require 'spec_helper'
|
645
|
+
```
|
646
|
+
|
636
647
|
### How to update existing knapsack report for a few test files?
|
637
648
|
|
638
649
|
You may want to look at monkey patch in [this issue](https://github.com/ArturT/knapsack/issues/34). Take into account that there are some cons of this approach.
|
@@ -648,6 +659,14 @@ For instance to run subset of tests for the first CI node with specified seed yo
|
|
648
659
|
|
649
660
|
Above example is for RSpec. You can use respectively rake task name and token environment variable when you want to run tests for minitest, cucumber or spinach.
|
650
661
|
|
662
|
+
### How can I change log level?
|
663
|
+
|
664
|
+
You can change log level by specifying the `KNAPSACK_LOG_LEVEL` environment variable.
|
665
|
+
|
666
|
+
KNAPSACK_LOG_LEVEL=warn bundle exec rake knapsack:rspec
|
667
|
+
|
668
|
+
Available values are `debug`, `info`, and `warn`. The default log level is `info`.
|
669
|
+
|
651
670
|
## Gem tests
|
652
671
|
|
653
672
|
### Spec
|
data/lib/knapsack.rb
CHANGED
data/lib/knapsack/config/env.rb
CHANGED
@@ -22,6 +22,14 @@ module Knapsack
|
|
22
22
|
ENV['KNAPSACK_TEST_DIR']
|
23
23
|
end
|
24
24
|
|
25
|
+
def log_level
|
26
|
+
{
|
27
|
+
"debug" => Knapsack::Logger::DEBUG,
|
28
|
+
"info" => Knapsack::Logger::INFO,
|
29
|
+
"warn" => Knapsack::Logger::WARN,
|
30
|
+
}[ENV['KNAPSACK_LOG_LEVEL']] || Knapsack::Logger::INFO
|
31
|
+
end
|
32
|
+
|
25
33
|
private
|
26
34
|
|
27
35
|
def index_starting_from_one(index)
|
data/lib/knapsack/version.rb
CHANGED
@@ -110,4 +110,18 @@ describe Knapsack::Config::Env do
|
|
110
110
|
it { should be_nil }
|
111
111
|
end
|
112
112
|
end
|
113
|
+
|
114
|
+
describe '.log_level' do
|
115
|
+
subject { described_class.log_level }
|
116
|
+
|
117
|
+
context 'when ENV exists' do
|
118
|
+
let(:log_level) { 'debug' }
|
119
|
+
before { stub_const("ENV", { 'KNAPSACK_LOG_LEVEL' => log_level }) }
|
120
|
+
it { should eql Knapsack::Logger::DEBUG }
|
121
|
+
end
|
122
|
+
|
123
|
+
context "when ENV doesn't exist" do
|
124
|
+
it { should eql Knapsack::Logger::INFO }
|
125
|
+
end
|
126
|
+
end
|
113
127
|
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.
|
4
|
+
version: 1.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ArturT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|