jeremymcanally-pending 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +6 -0
- data/README.txt +74 -0
- data/Rakefile +26 -0
- data/lib/pending.rb +48 -0
- data/test/test_pending.rb +54 -0
- metadata +81 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
pending
|
2
|
+
by Jeremy McAnally
|
3
|
+
http://jeremymcanally.com
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
pending lets you define a block of test code that is currently "pending" functionality,
|
8
|
+
similar to RSpec's pending method.
|
9
|
+
|
10
|
+
== FEATURES/PROBLEMS:
|
11
|
+
|
12
|
+
* A pending method to let you define pending test code
|
13
|
+
|
14
|
+
== SYNOPSIS:
|
15
|
+
|
16
|
+
The pending method lets you define a block of test code that is currently "pending"
|
17
|
+
functionality.
|
18
|
+
|
19
|
+
You can use it two ways. One is simply put a string as the parameter:
|
20
|
+
|
21
|
+
def test_web_service_integration
|
22
|
+
pending "This is not done yet..."
|
23
|
+
end
|
24
|
+
|
25
|
+
This will output a "P" in the test output alerting there is pending functionality.
|
26
|
+
|
27
|
+
You can also supply a block of code:
|
28
|
+
|
29
|
+
def test_new_helpers
|
30
|
+
pending "New helpers for database display" do
|
31
|
+
output = render_record(User.first)
|
32
|
+
assert_equal "Jerry User (jerry@users.com)", output
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
If the block doesn't fail, then the test will flunk with output like:
|
37
|
+
|
38
|
+
<New helpers for database display> did not fail.
|
39
|
+
|
40
|
+
If the test fails (i.e., the functionality isn't implemented), then it will
|
41
|
+
not fail the surrounding test.
|
42
|
+
|
43
|
+
== REQUIREMENTS:
|
44
|
+
|
45
|
+
* Test::Unit
|
46
|
+
|
47
|
+
== INSTALL:
|
48
|
+
|
49
|
+
sudo gem install pending
|
50
|
+
|
51
|
+
== LICENSE:
|
52
|
+
|
53
|
+
(The MIT License)
|
54
|
+
|
55
|
+
Copyright (c) 2008 FIXME (different license?)
|
56
|
+
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
58
|
+
a copy of this software and associated documentation files (the
|
59
|
+
'Software'), to deal in the Software without restriction, including
|
60
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
61
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
62
|
+
permit persons to whom the Software is furnished to do so, subject to
|
63
|
+
the following conditions:
|
64
|
+
|
65
|
+
The above copyright notice and this permission notice shall be
|
66
|
+
included in all copies or substantial portions of the Software.
|
67
|
+
|
68
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
69
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
70
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
71
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
72
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
73
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
74
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Look in the tasks/setup.rb file for the various options that can be
|
2
|
+
# configured in this Rakefile. The .rake files in the tasks directory
|
3
|
+
# are where the options are used.
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'bones'
|
7
|
+
Bones.setup
|
8
|
+
rescue LoadError
|
9
|
+
load 'tasks/setup.rb'
|
10
|
+
end
|
11
|
+
|
12
|
+
ensure_in_path 'lib'
|
13
|
+
require 'pending'
|
14
|
+
|
15
|
+
task :default => 'spec:run'
|
16
|
+
|
17
|
+
PROJ.name = 'pending'
|
18
|
+
PROJ.authors = 'FIXME (who is writing this software)'
|
19
|
+
PROJ.email = 'FIXME (your e-mail)'
|
20
|
+
PROJ.url = 'FIXME (project homepage)'
|
21
|
+
PROJ.version = '0.1'
|
22
|
+
PROJ.rubyforge.name = 'pending'
|
23
|
+
|
24
|
+
PROJ.spec.opts << '--color'
|
25
|
+
|
26
|
+
# EOF
|
data/lib/pending.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
module Test
|
2
|
+
module Unit
|
3
|
+
class TestCase
|
4
|
+
# The pending method lets you define a block of test code that is currently "pending"
|
5
|
+
# functionality.
|
6
|
+
#
|
7
|
+
# You can use it two ways. One is simply put a string as the parameter:
|
8
|
+
#
|
9
|
+
# def test_web_service_integration
|
10
|
+
# pending "This is not done yet..."
|
11
|
+
# end
|
12
|
+
#
|
13
|
+
# This will output a "P" in the test output alerting there is pending functionality.
|
14
|
+
#
|
15
|
+
# You can also supply a block of code:
|
16
|
+
#
|
17
|
+
# def test_new_helpers
|
18
|
+
# pending "New helpers for database display" do
|
19
|
+
# output = render_record(User.first)
|
20
|
+
# assert_equal "Jerry User (jerry@users.com)", output
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# If the block doesn't fail, then the test will flunk with output like:
|
25
|
+
#
|
26
|
+
# <New helpers for database display> did not fail.
|
27
|
+
#
|
28
|
+
# If the test fails (i.e., the functionality isn't implemented), then it will
|
29
|
+
# not fail the surrounding test.
|
30
|
+
#
|
31
|
+
def pending(description = "", &block)
|
32
|
+
if block_given?
|
33
|
+
failed = false
|
34
|
+
|
35
|
+
begin
|
36
|
+
block.call
|
37
|
+
rescue
|
38
|
+
failed = true
|
39
|
+
end
|
40
|
+
|
41
|
+
flunk("<#{description}> did not fail.") unless failed
|
42
|
+
end
|
43
|
+
|
44
|
+
print "P"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require File.dirname(__FILE__) + "/../lib/pending.rb"
|
3
|
+
|
4
|
+
# Quick and dirty way to test our output
|
5
|
+
class StdoutStub
|
6
|
+
attr_accessor :text
|
7
|
+
|
8
|
+
def write(text)
|
9
|
+
@text = text
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class TestPending < Test::Unit::TestCase
|
14
|
+
def test_output
|
15
|
+
old = $stdout
|
16
|
+
$> = StdoutStub.new
|
17
|
+
pending("poop")
|
18
|
+
|
19
|
+
assert_equal "P", $>.text
|
20
|
+
$> = $stdout
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_does_not_require_block
|
24
|
+
assert_nothing_raised do
|
25
|
+
pending("hello there")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_block_allows_fail
|
30
|
+
assert_nothing_raised do
|
31
|
+
pending("this is awesome") do
|
32
|
+
assert false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_flunk_when_no_flunk
|
38
|
+
assert_raises(Test::Unit::AssertionFailedError) do
|
39
|
+
pending("this is fail") do
|
40
|
+
assert true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_output_of_flunk_when_no_flunk
|
46
|
+
begin
|
47
|
+
pending("this is fail") do
|
48
|
+
assert true
|
49
|
+
end
|
50
|
+
rescue StandardError => e
|
51
|
+
assert_equal "<this is fail> did not fail.", e.message
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jeremymcanally-pending
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0.1"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jeremy McAnally
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-12-30 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bones
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.1.1
|
23
|
+
version:
|
24
|
+
description: pending lets you define a block of test code that is currently "pending" functionality, similar to RSpec's pending method.
|
25
|
+
email: jeremymcanally@gmail.com
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files:
|
31
|
+
- History.txt
|
32
|
+
- README.txt
|
33
|
+
files:
|
34
|
+
- History.txt
|
35
|
+
- Manifest.txt
|
36
|
+
- README.txt
|
37
|
+
- Rakefile
|
38
|
+
- lib/pending.rb
|
39
|
+
- tasks/ann.rake
|
40
|
+
- tasks/bones.rake
|
41
|
+
- tasks/gem.rake
|
42
|
+
- tasks/git.rake
|
43
|
+
- tasks/manifest.rake
|
44
|
+
- tasks/notes.rake
|
45
|
+
- tasks/post_load.rake
|
46
|
+
- tasks/rdoc.rake
|
47
|
+
- tasks/rubyforge.rake
|
48
|
+
- tasks/setup.rb
|
49
|
+
- tasks/spec.rake
|
50
|
+
- tasks/svn.rake
|
51
|
+
- tasks/test.rake
|
52
|
+
- test/test_pending.rb
|
53
|
+
has_rdoc: true
|
54
|
+
homepage: http://jeremymcanally.com
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options:
|
57
|
+
- --main
|
58
|
+
- README.txt
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
version:
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
requirements: []
|
74
|
+
|
75
|
+
rubyforge_project: pending
|
76
|
+
rubygems_version: 1.2.0
|
77
|
+
signing_key:
|
78
|
+
specification_version: 2
|
79
|
+
summary: pending lets you define a block of test code that is currently "pending" functionality, similar to RSpec's pending method
|
80
|
+
test_files:
|
81
|
+
- test/test_pending.rb
|