knapsack_pro 0.11.0 → 0.12.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
  SHA1:
3
- metadata.gz: a530e320acebeb3933454ddac789a2efa10c2f16
4
- data.tar.gz: ba2fdacf747a217b3e9c69d43639f30035c73b0a
3
+ metadata.gz: a406890fbfce1279d3666a454506cdcbd6304056
4
+ data.tar.gz: 1f6a678e6b2d02275961acacef5d30aa77fa2faf
5
5
  SHA512:
6
- metadata.gz: b102cd1ba0c0e1e4e600f87eb2726731b5b327f34c34f6cc968e951a9b0f88dcfc07445a64e5faca3051285a7966d1e656f8b14b756393bc8f696b1c17275996
7
- data.tar.gz: ef75c12a4f12ba7e1d9be5a3d00e537f51d6c00d59eec785db9c10d0a36177932a1569fa7e8687707470dbb5533a46430e4e90ac9786a0ff7369e103653402a4
6
+ metadata.gz: 641c3902159b91e7df6beba94c3f857620f36bce4e54e24f33c23844359eef8aae98235293c23acb4b7ac2bcf6509629f12e38530ae55d4a24457c6d96f30ee1
7
+ data.tar.gz: 5362880512e95bc8f559db2c42d517c5eb011fe0861db353cafee5b55094386b9fdd69529b7dcb3cf8b1d1286d337e2b63f990fcae02022fcd2e1ea01acb5e4f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 0.12.0
6
+
7
+ * Add support for Minitest::SharedExamples
8
+
9
+ Related PR:
10
+ https://github.com/ArturT/knapsack/pull/46
11
+
12
+ https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.11.0...v0.12.0
13
+
5
14
  ### 0.11.0
6
15
 
7
16
  * Add test file names encryption
data/README.md CHANGED
@@ -367,6 +367,9 @@ When you will enable test file names encryption then your first test suite split
367
367
 
368
368
  Each test file name is generated with `Digest::SHA2.hexdigest` method and 64 chars salt.
369
369
 
370
+ Before you enable test file encryption please ensure you are using fresh API key. You should not use the same API key for encrypted and non encrypted test suite.
371
+ You can generate API key for your test suite in [your dashboard](https://knapsackpro.com).
372
+
370
373
  #### How to enable test file names encryption?
371
374
 
372
375
  First you need to add environment variable `KNAPSACK_PRO_TEST_FILES_ENCRYPTED=true` to your CI server.
@@ -7,7 +7,12 @@ module KnapsackPro
7
7
  def self.test_path(obj)
8
8
  # Pick the first public method in the class itself, that starts with "test_"
9
9
  test_method_name = obj.public_methods(false).select{|m| m =~ /^test_/ }.first
10
- method_object = obj.method(test_method_name)
10
+ if test_method_name.nil?
11
+ # case for shared examples
12
+ method_object = obj.method(obj.location.sub(/.*?test_/, 'test_'))
13
+ else
14
+ method_object = obj.method(test_method_name)
15
+ end
11
16
  full_test_path = method_object.source_location.first
12
17
  parent_of_test_dir_regexp = Regexp.new("^#{@@parent_of_test_dir}")
13
18
  test_path = full_test_path.gsub(parent_of_test_dir_regexp, '.')
@@ -1,3 +1,3 @@
1
1
  module KnapsackPro
2
- VERSION = '0.11.0'
2
+ VERSION = '0.12.0'
3
3
  end
@@ -10,18 +10,6 @@ describe KnapsackPro::Adapters::MinitestAdapter do
10
10
  end
11
11
 
12
12
  describe '.test_path' do
13
- class FakeUserTest
14
- def test_user_age; end
15
-
16
- # method provided by Minitest
17
- # it returns test method name
18
- def name
19
- :test_user_age
20
- end
21
- end
22
-
23
- let(:obj) { FakeUserTest.new }
24
-
25
13
  subject { described_class.test_path(obj) }
26
14
 
27
15
  before do
@@ -30,7 +18,39 @@ describe KnapsackPro::Adapters::MinitestAdapter do
30
18
  described_class.class_variable_set(:@@parent_of_test_dir, parent_of_test_dir_regexp)
31
19
  end
32
20
 
33
- it { should eq './spec/knapsack_pro/adapters/minitest_adapter_spec.rb' }
21
+ context 'when regular test' do
22
+ class FakeUserTest
23
+ def test_user_age; end
24
+
25
+ # method provided by Minitest
26
+ # it returns test method name
27
+ def name
28
+ :test_user_age
29
+ end
30
+ end
31
+
32
+ let(:obj) { FakeUserTest.new }
33
+
34
+ it { should eq './spec/knapsack_pro/adapters/minitest_adapter_spec.rb' }
35
+ end
36
+
37
+ context 'when shared examples test' do
38
+ module FakeSharedExamples
39
+ def test_from_shared_example; end
40
+ end
41
+
42
+ class FakeSharedExamplesUserTest
43
+ include FakeSharedExamples
44
+
45
+ def location
46
+ "test that use FakeSharedExamples#test_from_shared_example"
47
+ end
48
+ end
49
+
50
+ let(:obj) { FakeSharedExamplesUserTest.new }
51
+
52
+ it { should eq './spec/knapsack_pro/adapters/minitest_adapter_spec.rb' }
53
+ end
34
54
  end
35
55
 
36
56
  describe 'BindTimeTrackerMinitestPlugin' do
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: 0.11.0
4
+ version: 0.12.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-08-28 00:00:00.000000000 Z
11
+ date: 2016-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake