minitest_should 0.1.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.
- data/.gitignore +5 -0
- data/.travis.yml +3 -0
- data/Gemfile +2 -0
- data/LICENSE +27 -0
- data/README.md +69 -0
- data/Rakefile +6 -0
- data/lib/minitest/should.rb +11 -0
- data/lib/minitest/should/base.rb +26 -0
- data/lib/minitest/should/version.rb +5 -0
- data/minitest_should.gemspec +24 -0
- data/test/test_minitest_should.rb +70 -0
- metadata +86 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Copyright (c) 2011 Spencer Steffen and Citrus Media Group.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification,
|
5
|
+
are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
8
|
+
this list of conditions and the following disclaimer.
|
9
|
+
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
12
|
+
and/or other materials provided with the distribution.
|
13
|
+
|
14
|
+
* Neither the name of Citrus Media Group nor the names of its
|
15
|
+
contributors may be used to endorse or promote products derived from this
|
16
|
+
software without specific prior written permission.
|
17
|
+
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
22
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
25
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
27
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# MiniTest Should [](http://travis-ci.org/citrus/minitest_should)
|
2
|
+
|
3
|
+
minitest_should allows you to write unit tests with [shoulda](https://github.com/thoughtbot/shoulda) style syntax. Contexts are not yet supported but you can use `should "do something"` instead of those `pesky_underscored_test_names`.
|
4
|
+
|
5
|
+
|
6
|
+
Usage
|
7
|
+
-----
|
8
|
+
|
9
|
+
gem "minitest"
|
10
|
+
|
11
|
+
require "minitest/autorun"
|
12
|
+
require "minitest/should"
|
13
|
+
|
14
|
+
|
15
|
+
# instead of this
|
16
|
+
class TestWithUnderscores < MiniTest::Unit::TestCase
|
17
|
+
|
18
|
+
def test_should_just_work
|
19
|
+
assert true
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
# use this!
|
25
|
+
class TestWithShould < MiniTest::Unit::TestCase
|
26
|
+
|
27
|
+
should "just work" do
|
28
|
+
assert true
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
Installation
|
36
|
+
------------
|
37
|
+
|
38
|
+
As usual, just use the `gem install` command:
|
39
|
+
|
40
|
+
(sudo) gem install minitest_should
|
41
|
+
|
42
|
+
Or add wordy as a gem in your Gemfile:
|
43
|
+
|
44
|
+
gem 'minitest_should', '~> 0.1.0'
|
45
|
+
|
46
|
+
Then run `bundle install`
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
Testing
|
51
|
+
-------
|
52
|
+
|
53
|
+
Testing is done with minitest. Run the tests with:
|
54
|
+
|
55
|
+
rake
|
56
|
+
|
57
|
+
|
58
|
+
Changelog
|
59
|
+
---------
|
60
|
+
|
61
|
+
**2011/11/8 - v0.1.0**
|
62
|
+
- it exists!
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
License
|
67
|
+
-------
|
68
|
+
|
69
|
+
Copyright (c) 2011 Spencer Steffen & Citrus, released under the New BSD License All rights reserved.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
module MiniTest
|
2
|
+
module Should
|
3
|
+
module Base
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.extend ClassMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
|
11
|
+
def should(name, &block)
|
12
|
+
method_name = [ "test_should_", name.downcase.gsub(/\s+/, '_') ].join
|
13
|
+
if self.test_methods.include?(method_name)
|
14
|
+
raise MiniTest::Should::DuplicateMethodError, "Test named `#{method_name}` already exists in #{self.name}."
|
15
|
+
else
|
16
|
+
self.send(:define_method, method_name, block)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
MiniTest::Unit::TestCase.send(:include, MiniTest::Should::Base)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "minitest/should/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "minitest_should"
|
7
|
+
s.version = MiniTest::Should::VERSION
|
8
|
+
s.authors = ["Spencer Steffen"]
|
9
|
+
s.email = ["spencer@citrusme.com"]
|
10
|
+
s.homepage = "https://github.com/citrus/minitest_should"
|
11
|
+
s.summary = %q{Shoulda style syntax for minitest test::unit. Contexts are not yet supported, but you can use `should "do something"` instead of those `pesky_underscored_test_names`.}
|
12
|
+
s.description = %q{Shoulda style syntax for minitest test::unit. Contexts are not yet supported, but you can use `should "do something"` instead of those `pesky_underscored_test_names`. Please see documentation for more information.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "minitest_should"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
s.add_development_dependency "rake", "> 0"
|
22
|
+
s.add_development_dependency "bundler", "> 0"
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "minitest/should"
|
3
|
+
begin; require "turn"; rescue LoadError; end
|
4
|
+
|
5
|
+
class TestMiniTestShould < MiniTest::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@something = "nothing"
|
9
|
+
end
|
10
|
+
|
11
|
+
def nothing
|
12
|
+
"blank"
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_version
|
16
|
+
assert_equal String, MiniTest::Should::VERSION.class
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_includes_minitest_should_base_module
|
20
|
+
assert self.class.included_modules.include?(MiniTest::Should::Base)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_respond_to_should
|
24
|
+
assert self.class.respond_to?(:should)
|
25
|
+
end
|
26
|
+
|
27
|
+
should "just work" do
|
28
|
+
assert true
|
29
|
+
end
|
30
|
+
|
31
|
+
should "create method from string" do
|
32
|
+
assert self.class.test_methods.include?("test_should_create_method_from_string")
|
33
|
+
end
|
34
|
+
|
35
|
+
should "work with multiple assertions" do
|
36
|
+
assert_block do
|
37
|
+
1 == 2 / 2
|
38
|
+
end
|
39
|
+
assert_raises NameError do
|
40
|
+
zomg
|
41
|
+
end
|
42
|
+
assert_instance_of String, "woo hoo"
|
43
|
+
assert_equal 2, 1 + 1
|
44
|
+
end
|
45
|
+
|
46
|
+
should "work with the tests instance variables" do
|
47
|
+
assert_equal "nothing", @something
|
48
|
+
end
|
49
|
+
|
50
|
+
should "work with the tests instance methods" do
|
51
|
+
assert_equal "blank", nothing
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_should_warn_on_duplicate_method_names
|
55
|
+
assert_raises MiniTest::Should::DuplicateMethodError do
|
56
|
+
self.class.send(:should, "warn on duplicate method names") do
|
57
|
+
assert true
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
should "also warn on duplicate method names" do
|
63
|
+
assert_raises MiniTest::Should::DuplicateMethodError do
|
64
|
+
self.class.send(:should, "also warn on duplicate method names") do
|
65
|
+
assert true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minitest_should
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.1.0
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Spencer Steffen
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-11-08 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rake
|
17
|
+
prerelease: false
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
type: :development
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: bundler
|
28
|
+
prerelease: false
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
|
+
none: false
|
31
|
+
requirements:
|
32
|
+
- - ">"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: "0"
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id002
|
37
|
+
description: Shoulda style syntax for minitest test::unit. Contexts are not yet supported, but you can use `should "do something"` instead of those `pesky_underscored_test_names`. Please see documentation for more information.
|
38
|
+
email:
|
39
|
+
- spencer@citrusme.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- .gitignore
|
48
|
+
- .travis.yml
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- lib/minitest/should.rb
|
54
|
+
- lib/minitest/should/base.rb
|
55
|
+
- lib/minitest/should/version.rb
|
56
|
+
- minitest_should.gemspec
|
57
|
+
- test/test_minitest_should.rb
|
58
|
+
homepage: https://github.com/citrus/minitest_should
|
59
|
+
licenses: []
|
60
|
+
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project: minitest_should
|
81
|
+
rubygems_version: 1.8.10
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Shoulda style syntax for minitest test::unit. Contexts are not yet supported, but you can use `should "do something"` instead of those `pesky_underscored_test_names`.
|
85
|
+
test_files:
|
86
|
+
- test/test_minitest_should.rb
|