forrest 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +20 -16
- data/bin/forrest +28 -4
- data/forrest-0.1.1.gem +0 -0
- data/forrest.gemspec +2 -3
- data/lib/extensions/test/unit/error.rb +44 -0
- data/lib/extensions/test/unit/error.rb~ +0 -0
- data/lib/forrest/all_runner.rb +62 -0
- data/lib/forrest/all_runner.rb~ +57 -0
- data/lib/forrest/runner.rb +2 -0
- data/lib/forrest/runner_flymake.rb +57 -0
- data/lib/forrest/scenario_runner.rb +1 -13
- metadata +23 -5
data/README.markdown
CHANGED
@@ -13,48 +13,52 @@ Print the stories/scenarios list
|
|
13
13
|
==> Printing all stories/scenarios...
|
14
14
|
|
15
15
|
|
16
|
-
+ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheBenchmarkForEachScenario
|
17
|
-
|__ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheBenchmarkForEachScenario#test_A_user_run_forrest_with_a_StoryName_as_a_param
|
16
|
+
+ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheBenchmarkForEachScenario
|
17
|
+
|__ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheBenchmarkForEachScenario#test_A_user_run_forrest_with_a_StoryName_as_a_param
|
18
18
|
|
19
19
|
|
20
20
|
+ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat%%--test/forrest_stories_test.rb
|
21
|
-
|__ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat#test_A_user_run_forrest_with_a_StoryName_as_a_param
|
21
|
+
|__ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat#test_A_user_run_forrest_with_a_StoryName_as_a_param
|
22
22
|
|
23
|
-
|__ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat#test_A_user_run_forrest_with_a_filepath_as_a_param
|
23
|
+
|__ ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat#test_A_user_run_forrest_with_a_filepath_as_a_param
|
24
24
|
|
25
25
|
Loaded suite
|
26
26
|
|
27
27
|
Run a specific story
|
28
28
|
----------------------
|
29
29
|
|
30
|
-
|
30
|
+
$ forrest ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheBenchmarkForEachScenario
|
31
31
|
|
32
|
-
|
32
|
+
==> Runing story...
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
Loaded suite ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat
|
35
|
+
Started
|
36
36
|
|
37
|
-
|
37
|
+
- As a stories user I want to see the stories report in a very nice format
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
A user run forrest with a filepath as a param
|
40
|
+
A user run forrest with a StoryName as a param
|
41
41
|
|
42
|
-
|
42
|
+
Finished in 0.001404 seconds.
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
2 tests, 0 assertions, 0 failures, 0 errors
|
45
|
+
1 story, 2 scenarios
|
46
46
|
|
47
47
|
Run a specific scenario
|
48
48
|
-------------------------
|
49
49
|
|
50
|
-
$ forrest ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat#test_A_user_run_forrest_with_a_StoryName_as_a_param
|
50
|
+
$ forrest ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat#test_A_user_run_forrest_with_a_StoryName_as_a_param
|
51
51
|
|
52
52
|
==> Runing scenario...
|
53
53
|
|
54
54
|
test/forrest_stories_test
|
55
55
|
Loaded suite test_A_user_run_forrest_with_a_filepath_as_a_param(ForrestStoriesTest::TestAsAStoriesUserIWantToSeeTheStoriesReportInAVeryNiceFormat)
|
56
56
|
Started
|
57
|
-
|
57
|
+
|
58
|
+
- As a stories user I want to see the stories report in a very nice format
|
59
|
+
|
60
|
+
A user run forrest with a StoryName as a param
|
61
|
+
|
58
62
|
Finished in 0.000997 seconds.
|
59
63
|
|
60
64
|
1 tests, 0 assertions, 0 failures, 0 errors
|
data/bin/forrest
CHANGED
@@ -56,11 +56,36 @@ def extract_scenario(arg)
|
|
56
56
|
scenario
|
57
57
|
end
|
58
58
|
|
59
|
+
def require_rails_env_and_test_file
|
60
|
+
begin
|
61
|
+
require "config/environment"
|
62
|
+
rescue LoadError
|
63
|
+
begin
|
64
|
+
require "../config/environment"
|
65
|
+
rescue LoadError
|
66
|
+
begin
|
67
|
+
require "../../config/environment"
|
68
|
+
rescue LoadError
|
69
|
+
require "../../../config/environment"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
begin
|
75
|
+
require "#{RAILS_ROOT}/test/stories/#{test_file_from_arg}"
|
76
|
+
rescue LoadError
|
77
|
+
begin
|
78
|
+
require "#{RAILS_ROOT}/test/integration/#{test_file_from_arg}"
|
79
|
+
rescue LoadError
|
80
|
+
require "#{RAILS_ROOT}/stories/#{test_file_from_arg}"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
59
85
|
def run_scenario(arg)
|
60
86
|
@running = 'scenario'
|
61
87
|
puts "==> Runing scenario...\n\n"
|
62
|
-
|
63
|
-
require "test/stories/#{test_file_from_arg}"
|
88
|
+
require_rails_env_and_test_file
|
64
89
|
|
65
90
|
Stories::ForrestScenarioRunner.run(extract_scenario(arg))
|
66
91
|
end
|
@@ -68,8 +93,7 @@ end
|
|
68
93
|
def run_story(story_name)
|
69
94
|
@running = 'story'
|
70
95
|
puts "==> Runing story...\n\n"
|
71
|
-
|
72
|
-
require "test/stories/#{test_file_from_arg}"
|
96
|
+
require_rails_env_and_test_file
|
73
97
|
|
74
98
|
Stories::ForrestRunner.run(story_name.constantize)
|
75
99
|
end
|
data/forrest-0.1.1.gem
ADDED
Binary file
|
data/forrest.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'date'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{forrest}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.2"
|
6
6
|
s.date = Date.today.to_s
|
7
7
|
s.summary = %q{Forrest is a runner for stories framework, you can run one story inside of a file that have many stories, can run one scenario or print the list of stories inside a file.}
|
8
8
|
s.description =<<DESCRIPTION
|
@@ -23,8 +23,7 @@ DESCRIPTION
|
|
23
23
|
s.has_rdoc = true
|
24
24
|
s.required_ruby_version = '>= 1.8'
|
25
25
|
|
26
|
-
|
27
|
-
# s.add_dependency("OptionParser", ">= 0.5.1")
|
26
|
+
s.add_dependency("stories", ">= 0.1.0")
|
28
27
|
|
29
28
|
s.files = Dir.glob("**/*").delete_if { |item| item.include?(".git") }
|
30
29
|
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Test
|
2
|
+
module Unit
|
3
|
+
class Error
|
4
|
+
# Returns a verbose version of the error description.
|
5
|
+
|
6
|
+
def long_display
|
7
|
+
backtrace = filter_backtrace(@exception.backtrace).join("\n ")
|
8
|
+
"#{colorize('Error:', :red)}\n" +
|
9
|
+
"#{colorize(filter_rails_html(message), :red)}\n#{backtrace}"
|
10
|
+
end
|
11
|
+
|
12
|
+
def filter_rails_html(str)
|
13
|
+
html = '<html xmlns="http://www.w3.org/1999/xhtml">
|
14
|
+
<head>
|
15
|
+
<title>Action Controller: Exception caught</title>
|
16
|
+
<style>
|
17
|
+
body { background-color: #fff; color: #333; }
|
18
|
+
|
19
|
+
body, p, ol, ul, td {
|
20
|
+
font-family: verdana, arial, helvetica, sans-serif;
|
21
|
+
font-size: 13px;
|
22
|
+
line-height: 18px;
|
23
|
+
}
|
24
|
+
|
25
|
+
pre {
|
26
|
+
background-color: #eee;
|
27
|
+
padding: 10px;
|
28
|
+
font-size: 11px;
|
29
|
+
}
|
30
|
+
|
31
|
+
a { color: #000; }
|
32
|
+
a:visited { color: #666; }
|
33
|
+
a:hover { color: #fff; background-color:#000; }
|
34
|
+
</style>
|
35
|
+
</head>
|
36
|
+
<body>
|
37
|
+
|
38
|
+
<h1>'
|
39
|
+
out = str.gsub(html, '')
|
40
|
+
out.split("\n")[0, 6].join("\n") + "..."
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
File without changes
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../extensions/test/unit/error')
|
2
|
+
|
3
|
+
module Stories
|
4
|
+
|
5
|
+
class ForrestRunnerAll < Test::Unit::UI::Console::TestRunner
|
6
|
+
@@all_stories = []
|
7
|
+
|
8
|
+
def test_finished(name)
|
9
|
+
set_story
|
10
|
+
end
|
11
|
+
|
12
|
+
def add_fault(fault)
|
13
|
+
@faults << fault
|
14
|
+
end
|
15
|
+
|
16
|
+
def print_scenario(scenario)
|
17
|
+
scenario.steps.each do |step|
|
18
|
+
puts " #{step}"
|
19
|
+
end
|
20
|
+
|
21
|
+
scenario.assertions.each do |assertion|
|
22
|
+
puts " #{assertion}"
|
23
|
+
end
|
24
|
+
|
25
|
+
puts
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_story
|
29
|
+
s ||= Story.new @suite.name
|
30
|
+
@story ||= Stories.all[s.name.constantize]
|
31
|
+
end
|
32
|
+
|
33
|
+
def print_story
|
34
|
+
set_story
|
35
|
+
puts @story.inspect
|
36
|
+
puts "- #{colorize(@story.name, :bold)} \n\n"
|
37
|
+
|
38
|
+
@story.scenarios.each do |scenario|
|
39
|
+
puts " #{scenario.name}"
|
40
|
+
|
41
|
+
unless scenario.steps.empty? && scenario.assertions.empty?
|
42
|
+
print_scenario scenario
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
def finished(elapsed_time)
|
49
|
+
puts
|
50
|
+
print_story
|
51
|
+
super
|
52
|
+
stories_count = 1
|
53
|
+
scenarios_count = 1 # @story.scenarios.size
|
54
|
+
|
55
|
+
puts colorize("#{stories_count} story, ", :bold) +
|
56
|
+
colorize(" #{scenarios_count} scenarios", :bold)
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../extensions/test/unit/error')
|
2
|
+
|
3
|
+
module Stories
|
4
|
+
|
5
|
+
class ForrestRunner < Test::Unit::UI::Console::TestRunner
|
6
|
+
def test_finished(name)
|
7
|
+
set_story
|
8
|
+
end
|
9
|
+
|
10
|
+
def add_fault(fault)
|
11
|
+
@faults << fault
|
12
|
+
end
|
13
|
+
|
14
|
+
def set_story
|
15
|
+
s ||= Story.new @suite.name
|
16
|
+
@story ||= Stories.all[s.name.constantize]
|
17
|
+
end
|
18
|
+
|
19
|
+
def print_scenario(scenario)
|
20
|
+
scenario.steps.each do |step|
|
21
|
+
puts " #{step}"
|
22
|
+
end
|
23
|
+
|
24
|
+
scenario.assertions.each do |assertion|
|
25
|
+
puts " #{assertion}"
|
26
|
+
end
|
27
|
+
|
28
|
+
puts
|
29
|
+
end
|
30
|
+
|
31
|
+
def print_story
|
32
|
+
puts "- #{colorize(@story.name, :bold)} \n\n"
|
33
|
+
|
34
|
+
@story.scenarios.each do |scenario|
|
35
|
+
puts " #{scenario.name}"
|
36
|
+
|
37
|
+
unless scenario.steps.empty? && scenario.assertions.empty?
|
38
|
+
print_scenario scenario
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def finished(elapsed_time)
|
44
|
+
puts
|
45
|
+
print_story
|
46
|
+
super
|
47
|
+
stories_count = 1
|
48
|
+
scenarios_count = @story.scenarios.size
|
49
|
+
|
50
|
+
puts colorize("#{stories_count} story, ", :bold) +
|
51
|
+
colorize(" #{scenarios_count} scenarios", :bold)
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/lib/forrest/runner.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), '../extensions/test/unit/error')
|
2
|
+
|
3
|
+
module Stories
|
4
|
+
|
5
|
+
class ForrestRunner < Test::Unit::UI::Console::TestRunner
|
6
|
+
def test_finished(name)
|
7
|
+
set_story
|
8
|
+
end
|
9
|
+
|
10
|
+
def add_fault(fault)
|
11
|
+
@faults << fault
|
12
|
+
end
|
13
|
+
|
14
|
+
def set_story
|
15
|
+
s ||= Story.new @suite.name
|
16
|
+
@story ||= Stories.all[s.name.constantize]
|
17
|
+
end
|
18
|
+
|
19
|
+
def print_scenario(scenario)
|
20
|
+
scenario.steps.each do |step|
|
21
|
+
puts " #{step}"
|
22
|
+
end
|
23
|
+
|
24
|
+
scenario.assertions.each do |assertion|
|
25
|
+
puts " #{assertion}"
|
26
|
+
end
|
27
|
+
|
28
|
+
puts
|
29
|
+
end
|
30
|
+
|
31
|
+
def print_story
|
32
|
+
puts "- #{colorize(@story.name, :bold)} \n\n"
|
33
|
+
|
34
|
+
@story.scenarios.each do |scenario|
|
35
|
+
puts " #{scenario.name}"
|
36
|
+
|
37
|
+
unless scenario.steps.empty? && scenario.assertions.empty?
|
38
|
+
print_scenario scenario
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def finished(elapsed_time)
|
44
|
+
puts
|
45
|
+
print_story
|
46
|
+
super
|
47
|
+
stories_count = 1
|
48
|
+
scenarios_count = @story.scenarios.size
|
49
|
+
|
50
|
+
puts colorize("#{stories_count} story, ", :bold) +
|
51
|
+
colorize(" #{scenarios_count} scenarios", :bold)
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
@@ -1,16 +1,4 @@
|
|
1
|
-
|
2
|
-
module Unit
|
3
|
-
class Error
|
4
|
-
# Returns a verbose version of the error description.
|
5
|
-
|
6
|
-
def long_display
|
7
|
-
backtrace = filter_backtrace(@exception.backtrace).join("\n ")
|
8
|
-
"#{colorize('Error:', :red)}\n #{colorize(message, :red)}\n#{backtrace}"
|
9
|
-
end
|
10
|
-
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
1
|
+
require File.join(File.dirname(__FILE__), '../extensions/test/unit/error')
|
14
2
|
|
15
3
|
module Stories
|
16
4
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Gaston Ramos
|
@@ -14,10 +14,23 @@ autorequire: forrest
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-21 00:00:00 -03:00
|
18
18
|
default_executable: forrest
|
19
|
-
dependencies:
|
20
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: stories
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 1
|
30
|
+
- 0
|
31
|
+
version: 0.1.0
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
21
34
|
description: |
|
22
35
|
Forrest is a runner for stories framework, you can run one story
|
23
36
|
inside of a file that have many stories, can run one scenario
|
@@ -39,11 +52,16 @@ files:
|
|
39
52
|
- forrest-0.1.1.gem
|
40
53
|
- pri
|
41
54
|
- forrest-0.1.0.gem
|
55
|
+
- lib/extensions/test/unit/error.rb~
|
56
|
+
- lib/extensions/test/unit/error.rb
|
42
57
|
- lib/forrest/runner.rb
|
43
58
|
- lib/forrest/scenario_runner.rb~
|
59
|
+
- lib/forrest/all_runner.rb~
|
44
60
|
- lib/forrest/unix_console_styler.rb
|
61
|
+
- lib/forrest/all_runner.rb
|
45
62
|
- lib/forrest/scenario_runner.rb
|
46
63
|
- lib/forrest/runner.rb~
|
64
|
+
- lib/forrest/runner_flymake.rb
|
47
65
|
- lib/object.rb
|
48
66
|
- lib/object.rb~
|
49
67
|
has_rdoc: true
|