minitest-metadata 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- MTVhYzE3YTRmZTJmYTEwYjI1ZTU3YTkxOTNhMzc3NzQ5ZWQ3ZjAyYg==
5
- data.tar.gz: !binary |-
6
- NGM0ZGFlYjc3YzQyYTQ0YTI1ZTc0NjIzYjczNmM0YzgxODJiNGMwNg==
2
+ SHA1:
3
+ metadata.gz: 11ec3433972b92cc70551d4a529c483ac9bffb9b
4
+ data.tar.gz: 07865b8c9b5c0c5828fa6f6bf22a306f74ae99b6
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NGRjYWVlMDA2N2EwMzVlMTk4NzlmNjAxYzlhYjAyMWU2MWZlMjljOTllOWI5
10
- Nzc1NWJkMTg1OTg5MmZmMDZkOGVlNzg2NzE5ZTdhMDg4Mzc2YzQyZTJjYjg1
11
- ZGZjNTgwZGY0Y2MxYjE1ZDk1NjBlZjhlMGVmYzUzZDkxM2UyMGU=
12
- data.tar.gz: !binary |-
13
- YWQzOGNmMWJkODZmMzRiYWYzZDNkYjM1MDI4YTFjMmMyNDAyZmRkMTgxNDBl
14
- ODAzMWE1Y2U4MGY1NDdjMTg1MjYzYmFjMmI1MmNmYTU1ZjgyZTU0OWMzMjJk
15
- OGZjYjYyMWJmZDhkZTI0YTM3M2MwNzA2ZjU0YTU5ODllNDZiNzM=
6
+ metadata.gz: e416fefbff9e576289c8bd26b2b5af969cfc489d0de4db4c1c1887934c41b4b0b55ed2c33eff508bb357acb5fe84c7a03d2d5e11c25ab81ad689845353983a08
7
+ data.tar.gz: 42ac439aeca53ef417184f4d47b5ec9239c841205a5ecf6eaf826a1ad725a87148a63d0815415edc5d4a8f06e8651733ee79aaafc52d46afe2a84f01c86f3595
@@ -4,6 +4,9 @@ rvm:
4
4
  - 2.1.2
5
5
  - jruby
6
6
  - rbx-2
7
+ branches:
8
+ except:
9
+ - /^v[0-9]/
7
10
  deploy:
8
11
  provider: rubygems
9
12
  api_key:
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # HEAD
2
2
 
3
+ # 0.6.0
4
+
5
+ * Performance improvements - @tmertens
6
+
3
7
  # 0.5.0
4
8
 
5
9
  * Fix minitest 5 compatibilty - @bbozo
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.6.0
@@ -2,7 +2,7 @@ module MiniTest::Metadata
2
2
  module ClassMethods
3
3
  # Returns Hash metadata for class' test methods
4
4
  def metadata
5
- @metadata ||= {}
5
+ @metadata ||= Hash.new({})
6
6
  end
7
7
  end
8
8
 
@@ -15,20 +15,19 @@ module MiniTest::Metadata
15
15
 
16
16
  # @private
17
17
  def it(description = "", *metadata, &block)
18
- old_it(description, &block).tap do |name|
19
- self.metadata[name] = _compute_metadata(metadata)
20
- end
18
+ name = old_it(description, &block)
19
+ self.metadata[name] = _compute_metadata(metadata) unless metadata.empty?
20
+ name
21
21
  end
22
22
 
23
23
  def _compute_metadata(metadata)
24
- metadata.inject({}) { |hash, key|
25
- if key.is_a?(Hash)
26
- hash.merge!(key)
27
- else
28
- hash[key] = true
29
- end
30
- hash
31
- }
24
+ if metadata[-1].is_a? Hash
25
+ meta = metadata.pop
26
+ else
27
+ meta = {}
28
+ end
29
+ metadata.each { |key| meta[key] = true }
30
+ meta
32
31
  end
33
32
  end
34
33
 
@@ -1,15 +1,28 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'json'
3
3
  require 'time'
4
-
5
- ENV['GITHUB_TOKEN'] = 'cebfd9d48eb57bee07660aea1eb166e4ac00d44a'
6
- ENV['TRAVIS_REPO_SLUG'] = 'wojtekmach/minitest-metadata'
4
+ require 'pp'
7
5
 
8
6
  sha = `git rev-parse HEAD`.strip
9
7
  tag = "v%s" % File.read(File.expand_path('../../VERSION', __FILE__)).strip
10
8
  token = ENV.fetch('GITHUB_TOKEN')
11
9
  repo = ENV.fetch('TRAVIS_REPO_SLUG')
12
10
 
11
+ cmd = "curl --silent -X POST https://api.travis-ci.org/auth/github?github_token=#{token}"
12
+ result = `#{cmd}`
13
+ travis_token = JSON(result)['access_token']
14
+
15
+ cmd = "curl --silent -H \"Authorization: token %{token}\" https://api.travis-ci.org/repos/%{repo}/builds?ids=%{id}" % {
16
+ id: ENV.fetch('TRAVIS_BUILD_ID'),
17
+ token: travis_token,
18
+ repo: repo,
19
+ }
20
+ result = `#{cmd}`
21
+ unless JSON(result).first['state'] == 'finished'
22
+ puts "Build not yet finished"
23
+ exit 1
24
+ end
25
+
13
26
  cmd = "curl -H \"Authorization: token %{token}\" -XPOST https://api.github.com/repos/%{repo}/git/refs -d '%{json}'" % {
14
27
  token: token,
15
28
  repo: repo,
@@ -4,3 +4,5 @@
4
4
  if git tag | grep --silent `cat VERSION`; then
5
5
  exit 1
6
6
  fi
7
+
8
+ echo 'Unreleased'
@@ -23,6 +23,16 @@ describe 'MiniTest::Spec' do
23
23
  @cls.metadata["test_0004_test4"].must_equal :vcr => true, :js => false
24
24
  end
25
25
 
26
+ it "new ::it returns the name of the test method" do
27
+ @cls = describe "A spec" do
28
+ include MiniTest::Metadata
29
+
30
+ @name = it "test1" do; end
31
+ end
32
+
33
+ @cls.instance_variable_get(:@name).must_equal "test_0001_test1"
34
+ end
35
+
26
36
  it "#meta returns empty hash when nothing passed to ::it" do
27
37
  metadata.must_equal({})
28
38
  end
metadata CHANGED
@@ -1,47 +1,47 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minitest-metadata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wojciech Mach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-15 00:00:00.000000000 Z
11
+ date: 2014-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.7'
20
- - - <
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '6.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ! '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '4.7'
30
- - - <
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '6.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ! '>='
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ! '>='
44
+ - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  description: Metadata (key-value) support for minitest/spec
@@ -51,9 +51,9 @@ executables: []
51
51
  extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
- - .gitignore
55
- - .travis.yml
56
- - .yardopts
54
+ - ".gitignore"
55
+ - ".travis.yml"
56
+ - ".yardopts"
57
57
  - Gemfile
58
58
  - HISTORY.md
59
59
  - README.md
@@ -75,12 +75,12 @@ require_paths:
75
75
  - lib
76
76
  required_ruby_version: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - ! '>='
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '0'
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - ! '>='
83
+ - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  requirements: []
@@ -89,4 +89,5 @@ rubygems_version: 2.2.2
89
89
  signing_key:
90
90
  specification_version: 4
91
91
  summary: Metadata (key-value) support for minitest/spec
92
- test_files: []
92
+ test_files:
93
+ - test/minitest/metadata_test.rb