tending 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2008-05-15
2
+
3
+ * 2 major enhancements
4
+
5
+ * Tending allows adding pending tests to Test::Unit test cases
6
+ * Tending can report on pending tests in files given a file pattern
@@ -0,0 +1,14 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/tending
6
+ lib/tending.rb
7
+ lib/tending/disable_auto_runner.rb
8
+ lib/tending/pending.rb
9
+ lib/tending/tending_report.rb
10
+ tending.gemspec
11
+ test/pending_files/file_one.rb
12
+ test/pending_files/file_two.rb
13
+ test/test_pending.rb
14
+ test/test_tending_report.rb
@@ -0,0 +1,76 @@
1
+ = tending
2
+
3
+ * http://tending.rubyforge.org
4
+ * git hub - http://github.com/dfg59/tending/tree/master
5
+ * public git repo - git://github.com/dfg59/tending.git
6
+
7
+ == DESCRIPTION:
8
+
9
+ tending allows you to add pending tests to your Test::Unit test cases
10
+
11
+ == FEATURES/PROBLEMS:
12
+
13
+ * tending allows adding pending tests to Test::Unit test cases
14
+ * tending can report on pending tests in files given a file pattern
15
+
16
+ == SYNOPSIS:
17
+
18
+ While writing your test cases, use tending to add place holders for tests you haven't yet
19
+ written using the pending method. For example:
20
+
21
+ require 'test/unit'
22
+ require 'rubygems'
23
+ require 'tending'
24
+
25
+ class TestFoo < Test::Unit::TestCase
26
+ def test_truth
27
+ assert true
28
+ end
29
+
30
+ pending 'test false scenario'
31
+ pending 'test edge cases'
32
+ end
33
+
34
+ After adding pending tests to your test files, you can use the tending command line tool to generate
35
+ a report of pending tests. This command accepts any file patterns that Dir.glob accepts. For example,
36
+ if I wanted a report of all pending tests within the test directory of my project and my current
37
+ working directory was the project root, I would execute the following:
38
+
39
+ tending 'test/*'
40
+
41
+ This will generate a detailed report, by file, of all pending tests.
42
+
43
+ == REQUIREMENTS:
44
+
45
+ * need 1.0.2
46
+ * hoe 1.5.1
47
+
48
+ == INSTALL:
49
+
50
+ * rubyforge - sudo gem install tending
51
+ * github - sudo gem install dfg59-tending --source=http://gems.github.com
52
+
53
+ == LICENSE:
54
+
55
+ (The MIT License)
56
+
57
+ Copyright (c) 2008 FIX
58
+
59
+ Permission is hereby granted, free of charge, to any person obtaining
60
+ a copy of this software and associated documentation files (the
61
+ 'Software'), to deal in the Software without restriction, including
62
+ without limitation the rights to use, copy, modify, merge, publish,
63
+ distribute, sublicense, and/or sell copies of the Software, and to
64
+ permit persons to whom the Software is furnished to do so, subject to
65
+ the following conditions:
66
+
67
+ The above copyright notice and this permission notice shall be
68
+ included in all copies or substantial portions of the Software.
69
+
70
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
71
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
72
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
73
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
74
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
75
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
76
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require './lib/tending.rb'
6
+
7
+ Hoe.new('tending', Tending::VERSION) do |p|
8
+ p.rubyforge_name = 'tending'
9
+ p.developer('Drew Olson', 'drew@drewolson.org')
10
+ p.extra_deps << ['need', '>= 1.0.2']
11
+ end
12
+
13
+ # vim: syntax=Ruby
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ require 'rubygems'
3
+ require 'need'
4
+ need {'../lib/tending/tending_report'}
5
+ need {'../lib/tending/disable_auto_runner'}
6
+
7
+ begin
8
+ reporter = Tending::TendingReport.new(*ARGV)
9
+ puts reporter.report
10
+ rescue ArgumentError
11
+ puts "usage: tending [file pattern]"
12
+ end
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+ require 'need'
3
+ need {'tending/pending'}
4
+
5
+ module Tending
6
+ VERSION = '1.0.0'
7
+ end
@@ -0,0 +1,8 @@
1
+ require "test/unit/autorunner"
2
+
3
+ class Test::Unit::AutoRunner
4
+ # disable autorunner for gathering pending tests
5
+ def self.run
6
+ $exit = 0
7
+ end
8
+ end
@@ -0,0 +1,16 @@
1
+ require 'test/unit/testcase'
2
+
3
+ class Test::Unit::TestCase
4
+ # allows creation of pending tests inside Test::Unit::TestCase
5
+ def self.pending(desc)
6
+ @@pending_tests ||= {}
7
+ caller_file = File.expand_path(caller.first.split(':').first)
8
+ @@pending_tests[caller_file] ||= []
9
+ @@pending_tests[caller_file] << desc
10
+ end
11
+
12
+ # return hash of files and associated pending tests
13
+ def self.pending_tests
14
+ @@pending_tests ||= {}
15
+ end
16
+ end
@@ -0,0 +1,34 @@
1
+ require 'rubygems'
2
+ require 'need'
3
+ need {'pending'}
4
+
5
+ module Tending
6
+ # class used to renerate reports of pending tests
7
+ class TendingReport
8
+ def initialize(pattern)
9
+ raise ArgumentError unless pattern.kind_of? String
10
+
11
+ @pattern = pattern
12
+ end
13
+
14
+ # generate report based on pattern
15
+ def report
16
+ Dir.glob(@pattern) do |file|
17
+ unless require file
18
+ load file
19
+ end
20
+ end
21
+
22
+ report_string = "\nPending Tests:\n"
23
+
24
+ Test::Unit::TestCase.pending_tests.each do |file,pending_tests|
25
+ report_string += "In #{file}:\n"
26
+ pending_tests.each do |pending_test|
27
+ report_string += " #{pending_test}\n"
28
+ end
29
+ end
30
+
31
+ report_string + "\n"
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,27 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{tending}
3
+ s.version = "1.0.0"
4
+
5
+ s.specification_version = 2 if s.respond_to? :specification_version=
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Drew Olson"]
9
+ s.date = %q{2008-05-15}
10
+ s.default_executable = %q{tending}
11
+ s.description = %q{tending allows you to add pending tests to your Test::Unit test cases}
12
+ s.email = ["drew@drewolson.org"]
13
+ s.executables = ["tending"]
14
+ s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
15
+ s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/tending", "lib/tending.rb", "lib/tending/disable_auto_runner.rb", "lib/tending/pending.rb", "lib/tending/tending_report.rb", "tending.gemspec", "test/pending_files/file_one.rb", "test/pending_files/file_two.rb", "test/test_pending.rb", "test/test_tending_report.rb"]
16
+ s.has_rdoc = true
17
+ s.homepage = %q{http://tending.rubyforge.org}
18
+ s.rdoc_options = ["--main", "README.txt"]
19
+ s.require_paths = ["lib"]
20
+ s.rubyforge_project = %q{tending}
21
+ s.rubygems_version = %q{1.1.1}
22
+ s.summary = %q{tending allows you to add pending tests to your Test::Unit test cases}
23
+ s.test_files = ["test/test_pending.rb", "test/test_tending_report.rb"]
24
+
25
+ s.add_dependency(%q<need>, [">= 1.0.2"])
26
+ s.add_dependency(%q<hoe>, [">= 1.5.1"])
27
+ end
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'need'
3
+ need {'../../lib/tending'}
4
+
5
+ Class.new(Test::Unit::TestCase).pending "foo"
@@ -0,0 +1,5 @@
1
+ require 'rubygems'
2
+ require 'need'
3
+ need {'../../lib/tending'}
4
+
5
+ Class.new(Test::Unit::TestCase).pending "foo"
@@ -0,0 +1,47 @@
1
+ require "test/unit"
2
+ require 'rubygems'
3
+ require 'need'
4
+ need {'../lib/tending'}
5
+
6
+ class TestPending < Test::Unit::TestCase
7
+ def test_pending_does_not_throw_error
8
+ assert_nothing_raised do
9
+ Class.new(Test::Unit::TestCase).pending "foo"
10
+ end
11
+ Test::Unit::TestCase.class_eval { @@pending_tests = {} }
12
+ end
13
+
14
+ def test_pending_tests_can_be_retrieved_from_test_class
15
+ klass = Class.new(Test::Unit::TestCase)
16
+ klass.pending "foo"
17
+ assert(klass.pending_tests, "Pending tests were not retrieved from Test::Unit class")
18
+ Test::Unit::TestCase.class_eval { @@pending_tests = {} }
19
+ end
20
+
21
+ def test_pending_test_can_be_retrieved_from_test_unit_parent_class
22
+ klass = Class.new(Test::Unit::TestCase)
23
+ klass.pending "foo"
24
+ assert(Test::Unit::TestCase.pending_tests, "Pending tests were not retrieved from Test::Unit class")
25
+ Test::Unit::TestCase.class_eval { @@pending_tests = {} }
26
+ end
27
+
28
+ def test_pending_tests_shared_across_classes
29
+ Class.new(Test::Unit::TestCase).pending "foo"
30
+ Class.new(Test::Unit::TestCase).pending "bar"
31
+ assert_equal({File.expand_path(__FILE__) => ["foo","bar"]}, Test::Unit::TestCase.pending_tests)
32
+ Test::Unit::TestCase.class_eval { @@pending_tests = {} }
33
+ end
34
+
35
+ def test_pending_tests_returns_correct_hash_for_one_file
36
+ Class.new(Test::Unit::TestCase).pending "foo"
37
+ assert_equal({File.expand_path(__FILE__) => ["foo"]}, Test::Unit::TestCase.pending_tests)
38
+ Test::Unit::TestCase.class_eval { @@pending_tests = {} }
39
+ end
40
+
41
+ def test_pending_tests_shares_across_files
42
+ need {'pending_files/file_one'}
43
+ need {'pending_files/file_two'}
44
+ assert_equal(2, Test::Unit::TestCase.pending_tests.size)
45
+ Test::Unit::TestCase.class_eval { @@pending_tests = {} }
46
+ end
47
+ end
@@ -0,0 +1,53 @@
1
+ require "test/unit"
2
+ require 'rubygems'
3
+ require 'need'
4
+ need {'../lib/tending'}
5
+ need {'../lib/tending/tending_report'}
6
+
7
+ class TestTendingReport < Test::Unit::TestCase
8
+ def test_raises_argument_error_when_string_is_not_passed_to_initialize
9
+ assert_raises ArgumentError do
10
+ Tending::TendingReport.new(1)
11
+ end
12
+ end
13
+
14
+ def test_raises_argument_error_when_nothing_passed_to_initialize
15
+ assert_raises ArgumentError do
16
+ Tending::TendingReport.new
17
+ end
18
+ end
19
+
20
+ def test_one_file_tending_report
21
+ simple_report = <<-EOS
22
+ Pending Tests:
23
+ In #{File.expand_path(File.join(File.dirname(__FILE__),"pending_files","file_one.rb"))}:
24
+ foo
25
+ EOS
26
+
27
+ simple_report = "\n"+simple_report+"\n"
28
+
29
+ pattern = File.expand_path(File.join(File.dirname(__FILE__),"pending_files","file_one.rb"))
30
+ reporter = Tending::TendingReport.new(pattern)
31
+
32
+ assert_equal(simple_report, reporter.report)
33
+ Test::Unit::TestCase.class_eval { @@pending_tests = {} }
34
+ end
35
+
36
+ def test_several_files_tending_report
37
+ mutli_file_report = <<-EOS
38
+ Pending Tests:
39
+ In #{File.expand_path(File.join(File.dirname(__FILE__),"pending_files","file_one.rb"))}:
40
+ foo
41
+ In #{File.expand_path(File.join(File.dirname(__FILE__),"pending_files","file_two.rb"))}:
42
+ foo
43
+ EOS
44
+
45
+ mutli_file_report = "\n"+mutli_file_report+"\n"
46
+
47
+ pattern = File.expand_path(File.join(File.dirname(__FILE__),"pending_files","*"))
48
+ reporter = Tending::TendingReport.new(pattern)
49
+
50
+ assert_equal(mutli_file_report, reporter.report)
51
+ Test::Unit::TestCase.class_eval { @@pending_tests = {} }
52
+ end
53
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tending
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Drew Olson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-05-16 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: need
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.2
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: hoe
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 1.5.1
32
+ version:
33
+ description: tending allows you to add pending tests to your Test::Unit test cases
34
+ email:
35
+ - drew@drewolson.org
36
+ executables:
37
+ - tending
38
+ extensions: []
39
+
40
+ extra_rdoc_files:
41
+ - History.txt
42
+ - Manifest.txt
43
+ - README.txt
44
+ files:
45
+ - History.txt
46
+ - Manifest.txt
47
+ - README.txt
48
+ - Rakefile
49
+ - bin/tending
50
+ - lib/tending.rb
51
+ - lib/tending/disable_auto_runner.rb
52
+ - lib/tending/pending.rb
53
+ - lib/tending/tending_report.rb
54
+ - tending.gemspec
55
+ - test/pending_files/file_one.rb
56
+ - test/pending_files/file_two.rb
57
+ - test/test_pending.rb
58
+ - test/test_tending_report.rb
59
+ has_rdoc: true
60
+ homepage: http://tending.rubyforge.org
61
+ post_install_message:
62
+ rdoc_options:
63
+ - --main
64
+ - README.txt
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: "0"
72
+ version:
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: "0"
78
+ version:
79
+ requirements: []
80
+
81
+ rubyforge_project: tending
82
+ rubygems_version: 1.1.1
83
+ signing_key:
84
+ specification_version: 2
85
+ summary: tending allows you to add pending tests to your Test::Unit test cases
86
+ test_files:
87
+ - test/test_pending.rb
88
+ - test/test_tending_report.rb