behaviors 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +8 -0
- data/Rakefile +19 -0
- data/test/behaviors_tasks_test.rb +12 -10
- data/test/behaviors_test.rb +1 -1
- data/test/tasks_test/Rakefile +8 -5
- metadata +22 -16
- data/test/tasks_test/doc/behaviors.html +0 -55
data/Manifest.txt
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'hoe'
|
4
|
+
|
5
|
+
Hoe.new('behaviors','1.0.1') do |p|
|
6
|
+
p.author = "Atomic Object LLC"
|
7
|
+
p.email = "dev@atomicobject.com"
|
8
|
+
p.url = "http://behaviors.rubyforge.org"
|
9
|
+
p.summary = "behavior-driven unit test helper"
|
10
|
+
p.description = <<-EOS
|
11
|
+
Behaviors allows for Test::Unit test case methods to be defined as
|
12
|
+
human-readable descriptions of program behavior. It also provides
|
13
|
+
Rake tasks to list the behaviors of your project.
|
14
|
+
EOS
|
15
|
+
p.test_globs = ['test/*_test.rb']
|
16
|
+
|
17
|
+
p.changes = <<-EOS
|
18
|
+
EOS
|
19
|
+
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
|
3
|
-
APP_ROOT = File.expand_path(File.dirname(__FILE__) + '/../')
|
2
|
+
require 'fileutils'
|
4
3
|
|
5
4
|
class BehaviorsTasksTest < Test::Unit::TestCase
|
5
|
+
include FileUtils
|
6
6
|
|
7
7
|
def setup
|
8
|
-
here = File.expand_path(File.dirname(__FILE__))
|
9
|
-
|
10
|
-
@base_cmd = "#{cmd} -f \"#{here}/tasks_test/Rakefile\" "
|
8
|
+
@here = File.expand_path(File.dirname(__FILE__))
|
9
|
+
@base_cmd = RUBY_PLATFORM[/mswin/] ? 'rake.cmd ' : 'rake '
|
11
10
|
end
|
12
11
|
|
13
12
|
#
|
@@ -22,12 +21,14 @@ class BehaviorsTasksTest < Test::Unit::TestCase
|
|
22
21
|
end
|
23
22
|
|
24
23
|
def run_cmd(cmd)
|
25
|
-
|
24
|
+
cd "#{@here}/tasks_test" do
|
25
|
+
@report = %x[ #{@base_cmd} #{cmd} ]
|
26
|
+
end
|
26
27
|
end
|
27
28
|
|
28
29
|
def see_html_task_output_message
|
29
|
-
@html_output_filename = "#{
|
30
|
-
assert_match
|
30
|
+
@html_output_filename = "#{@here}/tasks_test/behaviors_doc/behaviors.html"
|
31
|
+
assert_match(/Wrote #{@html_output_filename}/, @report)
|
31
32
|
end
|
32
33
|
|
33
34
|
def see_that_html_report_file_exits
|
@@ -37,8 +38,9 @@ class BehaviorsTasksTest < Test::Unit::TestCase
|
|
37
38
|
def html_report_file_should_contain(user_behaviors)
|
38
39
|
file_contents = File.read(@html_output_filename)
|
39
40
|
user_behaviors.each do |line|
|
40
|
-
assert_match
|
41
|
+
assert_match(/#{line}/, file_contents)
|
41
42
|
end
|
43
|
+
rm_rf File.dirname(@html_output_filename)
|
42
44
|
end
|
43
45
|
|
44
46
|
#
|
@@ -52,7 +54,7 @@ class BehaviorsTasksTest < Test::Unit::TestCase
|
|
52
54
|
" - be able to get user name and age",
|
53
55
|
" - be able to ask if a user is an adult"
|
54
56
|
]
|
55
|
-
assert_match
|
57
|
+
assert_match(/#{user_behaviors.join("\n")}/, @report)
|
56
58
|
end
|
57
59
|
|
58
60
|
def test_that_behaviors_tasks_should_list_behavioral_definitions_for_the_classes_under_test_in_html_output
|
data/test/behaviors_test.rb
CHANGED
@@ -45,6 +45,6 @@ class BehaviorsTest < Test::Unit::TestCase
|
|
45
45
|
|
46
46
|
def test_should_called_without_a_block_will_give_unimplemented_output_when_class_loads
|
47
47
|
unimplemented_output = "UNIMPLEMENTED CASE: Developer should go to meetings"
|
48
|
-
assert_match
|
48
|
+
assert_match(/#{unimplemented_output}/, $loading_developer_test_class_output)
|
49
49
|
end
|
50
50
|
end
|
data/test/tasks_test/Rakefile
CHANGED
@@ -1,16 +1,19 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
cd APP_ROOT
|
4
|
+
here = File.expand_path(File.dirname(__FILE__))
|
5
|
+
require "#{here}/../../lib/behaviors/reporttask"
|
8
6
|
|
9
7
|
desc 'Default: run unit tests.'
|
10
8
|
task :default => :test
|
11
9
|
|
12
10
|
Rake::TestTask.new(:test) do |t|
|
13
|
-
t.libs << "#{
|
11
|
+
t.libs << "#{here}/../../lib"
|
14
12
|
t.pattern = 'test/**/*_test.rb'
|
15
13
|
t.verbose = true
|
16
14
|
end
|
15
|
+
|
16
|
+
Behaviors::ReportTask.new(:behaviors) do |t|
|
17
|
+
t.pattern = 'test/**/*_test.rb'
|
18
|
+
t.html_dir = 'behaviors_doc'
|
19
|
+
end
|
metadata
CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: behaviors
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date:
|
6
|
+
version: 1.0.1
|
7
|
+
date: 2007-01-13 00:00:00 -05:00
|
8
8
|
summary: behavior-driven unit test helper
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: dev@atomicobject.com
|
12
|
-
homepage: http://
|
13
|
-
rubyforge_project:
|
14
|
-
description:
|
12
|
+
homepage: http://behaviors.rubyforge.org
|
13
|
+
rubyforge_project: behaviors
|
14
|
+
description: Behaviors allows for Test::Unit test case methods to be defined as human-readable descriptions of program behavior. It also provides Rake tasks to list the behaviors of your project.
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|
@@ -28,19 +28,17 @@ cert_chain:
|
|
28
28
|
authors:
|
29
29
|
- Atomic Object LLC
|
30
30
|
files:
|
31
|
+
- Manifest.txt
|
32
|
+
- Rakefile
|
33
|
+
- lib/behaviors.rb
|
31
34
|
- test/behaviors_tasks_test.rb
|
32
35
|
- test/behaviors_test.rb
|
33
|
-
- test/tasks_test
|
34
|
-
- test/tasks_test/doc
|
35
|
-
- test/tasks_test/lib
|
36
|
-
- test/tasks_test/Rakefile
|
37
|
-
- test/tasks_test/test
|
38
|
-
- test/tasks_test/doc/behaviors.html
|
39
36
|
- test/tasks_test/lib/user.rb
|
37
|
+
- test/tasks_test/Rakefile
|
40
38
|
- test/tasks_test/test/user_test.rb
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
test_files:
|
40
|
+
- test/behaviors_tasks_test.rb
|
41
|
+
- test/behaviors_test.rb
|
44
42
|
rdoc_options: []
|
45
43
|
|
46
44
|
extra_rdoc_files: []
|
@@ -51,5 +49,13 @@ extensions: []
|
|
51
49
|
|
52
50
|
requirements: []
|
53
51
|
|
54
|
-
dependencies:
|
55
|
-
|
52
|
+
dependencies:
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: hoe
|
55
|
+
version_requirement:
|
56
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 1.1.7
|
61
|
+
version:
|
@@ -1,55 +0,0 @@
|
|
1
|
-
<html>
|
2
|
-
<head>
|
3
|
-
<style>
|
4
|
-
|
5
|
-
div.title
|
6
|
-
{
|
7
|
-
width: 600px;
|
8
|
-
font: bold 14pt trebuchet ms;
|
9
|
-
}
|
10
|
-
|
11
|
-
div.specification
|
12
|
-
{
|
13
|
-
font: bold 12pt trebuchet ms;
|
14
|
-
border: solid 1px black;
|
15
|
-
width: 600px;
|
16
|
-
padding: 5px;
|
17
|
-
margin: 5px;
|
18
|
-
}
|
19
|
-
|
20
|
-
ul.requirements
|
21
|
-
{
|
22
|
-
font: normal 11pt verdana;
|
23
|
-
padding-left: 0;
|
24
|
-
margin-left: 0;
|
25
|
-
border-bottom: 1px solid gray;
|
26
|
-
width: 600px;
|
27
|
-
}
|
28
|
-
|
29
|
-
ul.requirements li
|
30
|
-
{
|
31
|
-
list-style: none;
|
32
|
-
margin: 0;
|
33
|
-
padding: 0.25em;
|
34
|
-
border-top: 1px solid gray;
|
35
|
-
}
|
36
|
-
</style>
|
37
|
-
</head>
|
38
|
-
<body>
|
39
|
-
<div class="title">Specifications for tasks_test</div>
|
40
|
-
|
41
|
-
<div class="specification">
|
42
|
-
User should:
|
43
|
-
<ul class="requirements">
|
44
|
-
|
45
|
-
<li>be able set user name and age during construction</li>
|
46
|
-
|
47
|
-
<li>be able to get user name and age</li>
|
48
|
-
|
49
|
-
<li>be able to ask if a user is an adult</li>
|
50
|
-
|
51
|
-
</ul>
|
52
|
-
</div>
|
53
|
-
|
54
|
-
</body>
|
55
|
-
</html>
|