minitest-tags 0.0.3 → 0.0.4
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.
- data/Gemfile +10 -0
- data/Gemfile.lock +27 -0
- data/README +7 -0
- data/Rakefile +19 -0
- data/lib/minitest/tags.rb +31 -0
- data/lib/minitest/version.rb +3 -0
- data/lib/minitest_tags.rb +16 -0
- data/minitest-tags.gemspec +25 -0
- data/test/foo_spec.rb +14 -0
- data/test/helper.rb +4 -0
- data/test/ttt_spec.rb +13 -0
- metadata +13 -3
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
archive-tar-minitar (0.5.2)
|
5
|
+
columnize (0.3.2)
|
6
|
+
linecache19 (0.5.12)
|
7
|
+
ruby_core_source (>= 0.1.4)
|
8
|
+
minitest (2.2.2)
|
9
|
+
minitest-tags (0.0.2)
|
10
|
+
ruby-debug-base19 (0.11.25)
|
11
|
+
columnize (>= 0.3.1)
|
12
|
+
linecache19 (>= 0.5.11)
|
13
|
+
ruby_core_source (>= 0.1.4)
|
14
|
+
ruby-debug19 (0.11.6)
|
15
|
+
columnize (>= 0.3.1)
|
16
|
+
linecache19 (>= 0.5.11)
|
17
|
+
ruby-debug-base19 (>= 0.11.19)
|
18
|
+
ruby_core_source (0.1.5)
|
19
|
+
archive-tar-minitar (>= 0.5.2)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
minitest (= 2.2.2)
|
26
|
+
minitest-tags
|
27
|
+
ruby-debug19
|
data/README
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
please take a look at Rakefile, Gemfile, and test/helper.rb. that's it, right?
|
2
|
+
|
3
|
+
rake test # run all test, just
|
4
|
+
|
5
|
+
rake test:on[follow] # only invoke the test case the desc inlcuding "follow" quoted by parenthesis
|
6
|
+
|
7
|
+
rake test:on[login] # only invoke the test case the desc inlcuding "login" quoted by parenthesis
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "rake/testtask"
|
3
|
+
require "bundler/setup"
|
4
|
+
Bundler.require :production
|
5
|
+
|
6
|
+
Rake::TestTask.new do |test|
|
7
|
+
test.libs << "feaure"
|
8
|
+
test.test_files = FileList["test/**/*_spec.rb"]
|
9
|
+
test.verbose = true
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :test do
|
13
|
+
desc "override the 'it' method to invoke the test case that marked by tag "
|
14
|
+
task :on, :tag do |t, args|
|
15
|
+
ENV["TAG"] = args[:tag]
|
16
|
+
Rake::Task[:test].invoke
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Minitest
|
2
|
+
module Tags
|
3
|
+
def self.included(base)
|
4
|
+
class << base
|
5
|
+
remove_method :it
|
6
|
+
end
|
7
|
+
base.extend ClassMethods
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def it desc, &block
|
12
|
+
tags = desc.match(/\(([\s\S]+)\)/)[1].split(",").map(&:strip) if desc.match(/\(([\s\S]+)\)/)
|
13
|
+
tags = tags || []
|
14
|
+
tag = ENV["TAG"]
|
15
|
+
block = proc { skip "(only the desc including tag #{tag} available)" } unless tags.include?(tag)
|
16
|
+
block ||= proc { skip "(no tests defined)" }
|
17
|
+
|
18
|
+
@specs ||= 0
|
19
|
+
@specs += 1
|
20
|
+
|
21
|
+
name = "test_%04d_%s" % [ @specs, desc.gsub(/\W+/, '_').downcase ]
|
22
|
+
|
23
|
+
define_method name, &block
|
24
|
+
|
25
|
+
self.children.each do |mod|
|
26
|
+
mod.send :undef_method, name if mod.public_method_defined? name
|
27
|
+
end
|
28
|
+
end # it
|
29
|
+
end # ClassMethods
|
30
|
+
end #Tags
|
31
|
+
end #Minitest
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#-*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "minitest/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "minitest-tags"
|
7
|
+
s.version = Minitest::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["wenbo", "Lorenzo Planas"]
|
10
|
+
s.email = ["yiyun6674@hotmail.com", "lplanas@qindio.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{add tags for minitest}
|
13
|
+
s.description = <<-EOF
|
14
|
+
when you invode the it method that coming with Minitest::Spec,
|
15
|
+
you can tag a test case by the words that quoted by parenthesis, then
|
16
|
+
specify the tag at your rake task, and the test case related to this tag
|
17
|
+
will be invoked
|
18
|
+
EOF
|
19
|
+
|
20
|
+
s.add_development_dependency "minitest", "~>2.2.2"
|
21
|
+
|
22
|
+
s.files = `git ls-files`.split("\n")
|
23
|
+
s.test_files = `git ls-files -- {test}/*`.split("\n")
|
24
|
+
s.require_paths = ["lib"]
|
25
|
+
end
|
data/test/foo_spec.rb
ADDED
data/test/helper.rb
ADDED
data/test/ttt_spec.rb
ADDED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: minitest-tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.4
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- wenbo
|
@@ -35,8 +35,18 @@ extensions: []
|
|
35
35
|
|
36
36
|
extra_rdoc_files: []
|
37
37
|
|
38
|
-
files:
|
39
|
-
|
38
|
+
files:
|
39
|
+
- Gemfile
|
40
|
+
- Gemfile.lock
|
41
|
+
- README
|
42
|
+
- Rakefile
|
43
|
+
- lib/minitest/tags.rb
|
44
|
+
- lib/minitest/version.rb
|
45
|
+
- lib/minitest_tags.rb
|
46
|
+
- minitest-tags.gemspec
|
47
|
+
- test/foo_spec.rb
|
48
|
+
- test/helper.rb
|
49
|
+
- test/ttt_spec.rb
|
40
50
|
has_rdoc: true
|
41
51
|
homepage: ""
|
42
52
|
licenses: []
|