minitest-metadata 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/HISTORY.md +6 -0
- data/README.md +17 -0
- data/lib/minitest-metadata.rb +3 -24
- data/lib/minitest/metadata.rb +31 -0
- data/lib/{minitest-metadata → minitest/metadata}/version.rb +1 -1
- data/minitest-metadata.gemspec +1 -1
- data/test/minitest-metadata_test.rb +5 -1
- metadata +11 -4
data/Gemfile.lock
CHANGED
data/HISTORY.md
CHANGED
data/README.md
CHANGED
@@ -57,7 +57,24 @@ class UsersAcceptanceTest < AcceptanceTest
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
```
|
60
|
+
## Note about speed
|
60
61
|
|
62
|
+
minitest-metadata adds some overhead so you might want to limit it to only
|
63
|
+
acceptance specs. If that's the case do this:
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
# Gemfile
|
67
|
+
|
68
|
+
group :test do
|
69
|
+
gem 'minitest-metadata', :require => false
|
70
|
+
end
|
71
|
+
|
72
|
+
# test/acceptance_test_helper.rb
|
73
|
+
|
74
|
+
class AcceptanceTest < MiniTest::Spec
|
75
|
+
include MiniTest::Metadata
|
76
|
+
end
|
77
|
+
```
|
61
78
|
|
62
79
|
## Requirements
|
63
80
|
|
data/lib/minitest-metadata.rb
CHANGED
@@ -1,27 +1,6 @@
|
|
1
|
-
require 'minitest/
|
2
|
-
|
3
|
-
require 'minitest-metadata/version'
|
1
|
+
require 'minitest/metadata/version'
|
2
|
+
require 'minitest/metadata'
|
4
3
|
|
5
4
|
class MiniTest::Spec
|
6
|
-
|
7
|
-
def self.metadata
|
8
|
-
@metadata ||= {}
|
9
|
-
end
|
10
|
-
|
11
|
-
# Returns Hash metadata for currently running test
|
12
|
-
def metadata
|
13
|
-
self.class.metadata[__name__] || {}
|
14
|
-
end
|
15
|
-
|
16
|
-
class << self
|
17
|
-
# @private
|
18
|
-
alias :old_it :it
|
19
|
-
|
20
|
-
# @private
|
21
|
-
def it(description = "", metadata = {}, &block)
|
22
|
-
old_it(description, &block).tap do |name|
|
23
|
-
self.metadata[name] = metadata
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
5
|
+
include MiniTest::Metadata
|
27
6
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module MiniTest::Metadata
|
2
|
+
module ClassMethods
|
3
|
+
# Returns Hash metadata for class' test methods
|
4
|
+
def metadata
|
5
|
+
@metadata ||= {}
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.included(klass)
|
10
|
+
klass.extend ClassMethods
|
11
|
+
klass.class_eval do
|
12
|
+
class << self
|
13
|
+
# @private
|
14
|
+
alias :old_it :it
|
15
|
+
|
16
|
+
# @private
|
17
|
+
def it(description = "", metadata = {}, &block)
|
18
|
+
old_it(description, &block).tap do |name|
|
19
|
+
self.metadata[name] = metadata
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
# Returns Hash metadata for currently running test
|
28
|
+
def metadata
|
29
|
+
self.class.metadata[__name__] || {}
|
30
|
+
end
|
31
|
+
end
|
data/minitest-metadata.gemspec
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
require "minitest/autorun"
|
2
|
-
require "minitest
|
2
|
+
require "minitest/metadata"
|
3
3
|
|
4
4
|
describe MiniTest::Spec do
|
5
|
+
include MiniTest::Metadata
|
6
|
+
|
5
7
|
it "::metadata returns metadata hash for each test method" do
|
6
8
|
@cls = describe "A spec" do
|
9
|
+
include MiniTest::Metadata
|
10
|
+
|
7
11
|
it "test1", :js => true do; end
|
8
12
|
|
9
13
|
it "test2" do; end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -59,7 +59,8 @@ files:
|
|
59
59
|
- README.md
|
60
60
|
- Rakefile
|
61
61
|
- lib/minitest-metadata.rb
|
62
|
-
- lib/minitest
|
62
|
+
- lib/minitest/metadata.rb
|
63
|
+
- lib/minitest/metadata/version.rb
|
63
64
|
- minitest-metadata.gemspec
|
64
65
|
- test/minitest-metadata_test.rb
|
65
66
|
homepage: ''
|
@@ -74,15 +75,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
75
|
- - ! '>='
|
75
76
|
- !ruby/object:Gem::Version
|
76
77
|
version: '0'
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
hash: -2385578600278812796
|
77
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
82
|
none: false
|
79
83
|
requirements:
|
80
84
|
- - ! '>='
|
81
85
|
- !ruby/object:Gem::Version
|
82
86
|
version: '0'
|
87
|
+
segments:
|
88
|
+
- 0
|
89
|
+
hash: -2385578600278812796
|
83
90
|
requirements: []
|
84
91
|
rubyforge_project: minitest-metadata
|
85
|
-
rubygems_version: 1.8.
|
92
|
+
rubygems_version: 1.8.24
|
86
93
|
signing_key:
|
87
94
|
specification_version: 3
|
88
95
|
summary: Metadata (key-value) support for minitest/spec
|