public
Description: Behaviour Driven Development framework for Ruby
Homepage: http://rspec.info
Clone URL: git://github.com/dchelimsky/rspec.git
Search Repo:
Click here to lend your support to: rspec and make a donation at www.pledgie.com !
Added IntentedTextFormatter.
btakita (author)
Thu May 22 01:02:02 -0700 2008
commit  294acb030f811fd546735aa819cdcf89d142b635
tree    547c9a522da11fa7c09c0693aafe245bd18808ca
parent  dff59d633d71eeb621bcd6b9f5d1238f78c62647
...
27
28
29
 
30
31
32
...
27
28
29
30
31
32
33
0
@@ -27,6 +27,7 @@
0
 * Applied patch from Bob Cotton: Nested ExampleGroups do not have a spec_path. Closes #224.
0
 * Add before_suite and after_suite callbacks to ExampleGroupMethods and Options. Closes #210.
0
 * The after(:suite) callback lambda is passed a boolean representing whether the suite passed or failed
0
+* Added IndentedTextFormatter. Closes #366.
0
 
0
 == Version 1.1.3
0
 
...
119
120
121
122
123
 
124
125
126
...
119
120
121
 
122
123
124
125
126
0
@@ -119,8 +119,8 @@
0
 
0
       def run
0
         examples = examples_to_run
0
- return true if examples.empty?
0
         reporter.add_example_group(self)
0
+ return true if examples.empty?
0
         return dry_run(examples) if dry_run?
0
 
0
         plugin_mock_framework
...
46
47
48
 
49
50
51
...
46
47
48
49
50
51
52
0
@@ -46,6 +46,7 @@
0
                                                     "progress|p : Text progress",
0
                                                     "profile|o : Text progress with profiling of 10 slowest examples",
0
                                                     "specdoc|s : Example doc as text",
0
+ "indented|i : Example doc as indented text",
0
                                                     "html|h : A nice HTML report",
0
                                                     "failing_examples|e : Write all failing examples - input for --example",
0
                                                     "failing_example_groups|g : Write all failing example groups - input for --example",
...
8
9
10
 
 
11
12
13
...
8
9
10
11
12
13
14
15
0
@@ -8,6 +8,8 @@
0
       EXAMPLE_FORMATTERS = { # Load these lazily for better speed
0
                'specdoc' => ['spec/runner/formatter/specdoc_formatter', 'Formatter::SpecdocFormatter'],
0
                      's' => ['spec/runner/formatter/specdoc_formatter', 'Formatter::SpecdocFormatter'],
0
+ 'indented' => ['spec/runner/formatter/indented_text_formatter', 'Formatter::IndentedTextFormatter'],
0
+ 'i' => ['spec/runner/formatter/indented_text_formatter', 'Formatter::IndentedTextFormatter'],
0
                   'html' => ['spec/runner/formatter/html_formatter', 'Formatter::HtmlFormatter'],
0
                      'h' => ['spec/runner/formatter/html_formatter', 'Formatter::HtmlFormatter'],
0
               'progress' => ['spec/runner/formatter/progress_bar_formatter', 'Formatter::ProgressBarFormatter'],
...
6
7
8
9
 
10
11
12
...
6
7
8
 
9
10
11
12
0
@@ -6,7 +6,7 @@
0
       TINY = 3
0
       RELEASE_CANDIDATE = nil
0
 
0
- BUILD_TIME_UTC = 20080522065805
0
+ BUILD_TIME_UTC = 20080522075859
0
 
0
       STRING = [MAJOR, MINOR, TINY].join('.')
0
       TAG = "REL_#{[MAJOR, MINOR, TINY, RELEASE_CANDIDATE].compact.join('_')}".upcase.gsub(/\.|-/, '_')
...
20
21
22
23
 
24
25
26
27
28
 
 
29
30
31
32
33
34
 
 
 
 
 
35
36
37
 
 
 
 
38
39
40
41
42
43
44
45
46
 
 
 
 
47
48
49
50
51
52
53
54
55
56
 
 
 
 
 
 
 
 
 
 
 
 
57
58
59
60
61
 
 
 
 
 
 
 
 
 
 
 
62
63
64
65
66
 
 
 
 
 
 
 
 
67
68
69
70
71
 
 
 
 
 
 
 
 
 
 
72
73
74
75
76
 
 
 
 
 
 
 
 
 
 
77
78
79
80
81
82
 
 
 
 
 
 
 
83
84
85
86
87
88
 
 
 
 
89
90
91
92
93
94
95
96
97
98
 
 
 
 
 
 
99
100
101
102
103
104
105
106
107
 
 
 
 
 
108
109
110
111
112
113
114
115
116
 
 
 
 
 
 
 
 
 
 
 
 
117
118
119
120
121
122
 
 
 
 
123
124
125
...
20
21
22
 
23
24
25
 
 
 
26
27
28
29
 
 
 
 
30
31
32
33
34
35
 
 
36
37
38
39
40
41
 
 
 
 
 
 
 
42
43
44
45
46
47
 
 
 
 
 
 
 
 
48
49
50
51
52
53
54
55
56
57
58
59
60
 
 
 
 
61
62
63
64
65
66
67
68
69
70
71
72
 
 
 
 
73
74
75
76
77
78
79
80
81
 
 
 
 
82
83
84
85
86
87
88
89
90
91
92
 
 
 
 
93
94
95
96
97
98
99
100
101
102
103
 
 
 
 
 
104
105
106
107
108
109
110
111
112
 
 
 
 
113
114
115
116
117
118
 
 
 
 
 
 
 
 
119
120
121
122
123
124
125
126
 
 
 
 
 
 
 
127
128
129
130
131
132
133
 
 
 
 
 
 
 
134
135
136
137
138
139
140
141
142
143
144
145
146
147
 
 
 
 
148
149
150
151
152
153
154
0
@@ -20,106 +20,135 @@
0
 
0
         describe "where ExampleGroup has no superclasss with a description" do
0
           before do
0
- formatter.add_example_group(example_group)
0
+ add_example_group
0
           end
0
 
0
- it "should produce standard summary without pending when pending has a 0 count" do
0
- formatter.dump_summary(3, 2, 1, 0)
0
- io.string.should have_example_group_output("\nFinished in 3 seconds\n\n2 examples, 1 failure\n")
0
+ def add_example_group
0
+ formatter.add_example_group(example_group)
0
           end
0
 
0
- it "should produce standard summary" do
0
- formatter.dump_summary(3, 2, 1, 4)
0
- io.string.should have_example_group_output("\nFinished in 3 seconds\n\n2 examples, 1 failure, 4 pending\n")
0
- end
0
+ describe "#dump_summary" do
0
+ it "should produce standard summary without pending when pending has a 0 count" do
0
+ formatter.dump_summary(3, 2, 1, 0)
0
+ io.string.should have_example_group_output("\nFinished in 3 seconds\n\n2 examples, 1 failure\n")
0
+ end
0
 
0
- it "should push ExampleGroup name" do
0
- io.string.should eql("\nExampleGroup\n")
0
+ it "should produce standard summary" do
0
+ formatter.dump_summary(3, 2, 1, 4)
0
+ io.string.should have_example_group_output("\nFinished in 3 seconds\n\n2 examples, 1 failure, 4 pending\n")
0
+ end
0
           end
0
 
0
- it "when having an error, should push failing spec name and failure number" do
0
- formatter.example_failed(
0
- example_group.it("spec"),
0
- 98,
0
- Reporter::Failure.new("c s", RuntimeError.new)
0
- )
0
- io.string.should have_example_group_output("- spec (ERROR - 98)\n")
0
+ describe "#add_example_group" do
0
+ it "should push ExampleGroup name" do
0
+ io.string.should eql("\nExampleGroup\n")
0
+ end
0
           end
0
 
0
- it "when having an expectation failure, should push failing spec name and failure number" do
0
- formatter.example_failed(
0
- example_group.it("spec"),
0
- 98,
0
- Reporter::Failure.new("c s", Spec::Expectations::ExpectationNotMetError.new)
0
- )
0
- io.string.should have_example_group_output("- spec (FAILED - 98)\n")
0
- end
0
+ describe "#example_failed" do
0
+ describe "where ExampleGroup has no superclasss with a description" do
0
+ describe "when having an error" do
0
+ it "should push failing spec name and failure number" do
0
+ formatter.example_failed(
0
+ example_group.it("spec"),
0
+ 98,
0
+ Reporter::Failure.new("c s", RuntimeError.new)
0
+ )
0
+ io.string.should have_example_group_output("- spec (ERROR - 98)\n")
0
+ end
0
+ end
0
 
0
- it "should push nothing on start" do
0
- formatter.start(5)
0
- io.string.should have_example_group_output("")
0
- end
0
+ describe "when having an expectation failure" do
0
+ it "should push failing spec name and failure number" do
0
+ formatter.example_failed(
0
+ example_group.it("spec"),
0
+ 98,
0
+ Reporter::Failure.new("c s", Spec::Expectations::ExpectationNotMetError.new)
0
+ )
0
+ io.string.should have_example_group_output("- spec (FAILED - 98)\n")
0
+ end
0
+ end
0
+ end
0
 
0
- it "should push nothing on start dump" do
0
- formatter.start_dump
0
- io.string.should have_example_group_output("")
0
- end
0
+ describe "where ExampleGroup has two superclasses with a description" do
0
+ attr_reader :child_example_group, :grand_child_example_group
0
+
0
+ def add_example_group
0
+ @child_example_group = Class.new(example_group).describe("Child ExampleGroup")
0
+ @grand_child_example_group = Class.new(child_example_group).describe("GrandChild ExampleGroup")
0
+ formatter.add_example_group(grand_child_example_group)
0
+ end
0
 
0
- it "should push passing spec name" do
0
- formatter.example_passed(example_group.it("spec"))
0
- io.string.should have_example_group_output("- spec\n")
0
- end
0
+ describe "when having an error" do
0
+ it "should push failing spec name and failure number" do
0
+ formatter.example_failed(
0
+ example_group.it("spec"),
0
+ 98,
0
+ Reporter::Failure.new("c s", RuntimeError.new)
0
+ )
0
+ io.string.should have_nested_example_group_output("- spec (ERROR - 98)\n")
0
+ end
0
+ end
0
 
0
- it "should push pending example name and message" do
0
- formatter.example_pending(example_group.examples.first, 'reason')
0
- io.string.should have_example_group_output("- example (PENDING: reason)\n")
0
- end
0
+ describe "when having an expectation" do
0
+ it "should push failing spec name and failure number" do
0
+ formatter.example_failed(
0
+ example_group.it("spec"),
0
+ 98,
0
+ Reporter::Failure.new("c s", Spec::Expectations::ExpectationNotMetError.new)
0
+ )
0
+ io.string.should have_nested_example_group_output("- spec (FAILED - 98)\n")
0
+ end
0
+ end
0
 
0
- it "should dump pending" do
0
- formatter.example_pending(example_group.examples.first, 'reason')
0
- io.rewind
0
- formatter.dump_pending
0
- io.string.should =~ /Pending\:\nExampleGroup example \(reason\)\n/
0
+ def have_nested_example_group_output(expected_output)
0
+ expected_full_output = "\nExampleGroup Child ExampleGroup GrandChild ExampleGroup\n#{expected_output}"
0
+ ::Spec::Matchers::SimpleMatcher.new(expected_full_output) do |actual|
0
+ actual == expected_full_output
0
+ end
0
+ end
0
+ end
0
           end
0
 
0
- def have_example_group_output(expected_output)
0
- expected = "\nExampleGroup\n#{expected_output}"
0
- ::Spec::Matchers::SimpleMatcher.new(expected) do |actual|
0
- actual == expected
0
+ describe "#start" do
0
+ it "should push nothing on start" do
0
+ formatter.start(5)
0
+ io.string.should have_example_group_output("")
0
             end
0
           end
0
- end
0
-
0
- describe "where ExampleGroup has two superclasses with a description" do
0
- attr_reader :child_example_group, :grand_child_example_group
0
- before do
0
- @child_example_group = Class.new(example_group).describe("Child ExampleGroup")
0
- @grand_child_example_group = Class.new(child_example_group).describe("GrandChild ExampleGroup")
0
- formatter.add_example_group(grand_child_example_group)
0
+
0
+ describe "#start_dump" do
0
+ it "should push nothing on start dump" do
0
+ formatter.start_dump
0
+ io.string.should have_example_group_output("")
0
+ end
0
           end
0
 
0
- specify "when having an error, should push failing spec name and failure number" do
0
- formatter.example_failed(
0
- example_group.it("spec"),
0
- 98,
0
- Reporter::Failure.new("c s", RuntimeError.new)
0
- )
0
- io.string.should have_nested_example_group_output("- spec (ERROR - 98)\n")
0
+ describe "#example_passed" do
0
+ it "should push passing spec name" do
0
+ formatter.example_passed(example_group.it("spec"))
0
+ io.string.should have_example_group_output("- spec\n")
0
+ end
0
           end
0
 
0
- specify "when having an expectation failure, should push failing spec name and failure number" do
0
- formatter.example_failed(
0
- example_group.it("spec"),
0
- 98,
0
- Reporter::Failure.new("c s", Spec::Expectations::ExpectationNotMetError.new)
0
- )
0
- io.string.should have_nested_example_group_output("- spec (FAILED - 98)\n")
0
+ describe "#example_pending" do
0
+ it "should push pending example name and message" do
0
+ formatter.example_pending(example_group.examples.first, 'reason')
0
+ io.string.should have_example_group_output("- example (PENDING: reason)\n")
0
+ end
0
+
0
+ it "should dump pending" do
0
+ formatter.example_pending(example_group.examples.first, 'reason')
0
+ io.rewind
0
+ formatter.dump_pending
0
+ io.string.should =~ /Pending\:\nExampleGroup example \(reason\)\n/
0
+ end
0
           end
0
 
0
- def have_nested_example_group_output(expected_output)
0
- expected_full_output = "\nExampleGroup Child ExampleGroup GrandChild ExampleGroup\n#{expected_output}"
0
- ::Spec::Matchers::SimpleMatcher.new(expected_full_output) do |actual|
0
- actual == expected_full_output
0
+ def have_example_group_output(expected_output)
0
+ expected = "\nExampleGroup\n#{expected_output}"
0
+ ::Spec::Matchers::SimpleMatcher.new(expected) do |actual|
0
+ actual == expected
0
             end
0
           end
0
         end

Comments

  • dchelimsky Thu May 22 06:38:07 -0700 2008

    This is pretty sweet. Thanks Brian.