minitest-sugar 0.0.2 → 0.0.3
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/README.md +13 -1
- data/lib/minitest-sugar.rb +7 -7
- data/lib/minitest-sugar/version.rb +2 -2
- data/minitest-sugar.gemspec +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -18,6 +18,18 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
+
Allow to create tests in a more human readable form:
|
22
|
+
|
23
|
+
```
|
24
|
+
class TruthTest < MiniTest::Unit::TestCase
|
25
|
+
extend MiniTest::Sugar
|
26
|
+
|
27
|
+
test 'assert the truth' do
|
28
|
+
assert true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
21
33
|
See [rubydoc](http://rubydoc.info/github/frodsan/minitest-sugar/master/frames).
|
22
34
|
|
23
35
|
## Contributing
|
@@ -26,4 +38,4 @@ See [rubydoc](http://rubydoc.info/github/frodsan/minitest-sugar/master/frames).
|
|
26
38
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
39
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
40
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
-
5. Create new Pull Request
|
41
|
+
5. Create new Pull Request
|
data/lib/minitest-sugar.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module MiniTest
|
2
2
|
module Sugar
|
3
3
|
# Allow to create tests in a more human readable form.
|
4
4
|
#
|
@@ -6,21 +6,21 @@ module Minitest
|
|
6
6
|
# extend MiniTest::Sugar
|
7
7
|
#
|
8
8
|
# test 'assert the truth' do
|
9
|
-
# assert
|
9
|
+
# assert true
|
10
10
|
# end
|
11
11
|
# end
|
12
|
-
def test
|
12
|
+
def test name, &block
|
13
13
|
test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
|
14
14
|
defined = instance_method(test_name) rescue false
|
15
15
|
raise "#{test_name} is already defined in #{self}" if defined
|
16
16
|
|
17
17
|
if block_given?
|
18
|
-
define_method
|
18
|
+
define_method test_name, &block
|
19
19
|
else
|
20
|
-
define_method
|
21
|
-
flunk
|
20
|
+
define_method test_name do
|
21
|
+
flunk 'No implementation provided for #{name}'
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
data/minitest-sugar.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
13
13
|
gem.name = 'minitest-sugar'
|
14
14
|
gem.require_paths = ['lib']
|
15
|
-
gem.version =
|
15
|
+
gem.version = MiniTest::Sugar::VERSION
|
16
16
|
|
17
17
|
gem.add_dependency 'minitest', '>= 3.1.0'
|
18
18
|
end
|