public
Description: A Rails app that uses voting to identify pain points.
Clone URL: git://github.com/btakita/pain-point.git
Search Repo:
Updated rspec & rspec-rails. Rspec added IndentedTextFormatter.
btakita (author)
Thu May 22 01:40:32 -0700 2008
commit  10059a771e3601ba0f244919d61613913282817c
tree    66743df4e1e42d479e32258bbd320c8ec58b1631
parent  d9e0e769e372d97511e64ffad1835766969cf499
...
1
2
3
4
5
...
1
 
2
3
4
0
@@ -1,5 +1,4 @@
0
 dir = File.dirname(__FILE__)
0
-ARGV.push('--require', "#{dir}/spec_helpers/indented_text_formatter", '--options', "#{dir}/spec.opts")
0
 
0
 Dir["#{dir}/{rails_integration}/**/*_spec.rb"].each do |file|
0
   require file
...
1
2
3
4
5
...
1
 
2
3
4
0
@@ -1,5 +1,4 @@
0
 dir = File.dirname(__FILE__)
0
-ARGV.push('--require', "#{dir}/spec_helpers/indented_text_formatter", '--options', "#{dir}/spec.opts")
0
 
0
 Dir["#{dir}/{selenium}/**/*_spec.rb"].each do |file|
0
   require file
...
1
2
3
 
4
5
6
...
1
2
 
3
4
5
6
0
@@ -1,6 +1,6 @@
0
 --colour
0
 --format
0
-profile
0
+indented
0
 --loadby
0
 mtime
0
 --reverse
...
1
2
3
 
4
5
6
...
1
2
3
4
5
6
7
0
@@ -1,6 +1,7 @@
0
 ENV["RAILS_ENV"] = "test"
0
 dir = File.dirname(__FILE__)
0
 require File.expand_path("#{dir}/../config/environment")
0
+#ARGV.concat ["--options", "#{dir}/spec.opts"]
0
 require 'spec'
0
 require 'spec/rails'
0
 require 'hpricot'
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,49 +1 @@
0
-require 'spec/runner/formatter/base_text_formatter'
0
-
0
-module Spec
0
- module Runner
0
- module Formatter
0
- class IndentedTextFormatter < BaseTextFormatter
0
- def add_example_group(example_group)
0
- super
0
- if example_group.description_args
0
- output.puts "#{example_group_indentation(example_group)}#{example_group.description_args}"
0
- output.flush
0
- end
0
- end
0
-
0
- def example_failed(example, counter, failure)
0
- message = if failure.expectation_not_met?
0
- "#{example_group_indentation(example.class)} #{example.description} (FAILED - #{counter})"
0
- else
0
- "#{example_group_indentation(example.class)} #{example.description} (ERROR - #{counter})"
0
- end
0
-
0
- output.puts(failure.expectation_not_met? ? red(message) : magenta(message))
0
- output.flush
0
- end
0
-
0
- def example_passed(example)
0
- message = "#{example_group_indentation(example.class)} #{example.description}"
0
- output.puts green(message)
0
- output.flush
0
- end
0
-
0
- def example_pending(example_group_description, example, message)
0
- super
0
- output.puts yellow("#{example_group_indentation(example.class)} #{example.description} (PENDING: #{message})")
0
- output.flush
0
- end
0
-
0
- def example_group_indentation(example_group)
0
- example_group_chain = []
0
- example_group.send(:execute_in_class_hierarchy) do |parent_example_group|
0
- example_group_chain << parent_example_group if parent_example_group.description_args
0
- end
0
- ' ' * (example_group_chain - [example_group]).length
0
- end
0
- end
0
- end
0
- end
0
-end
...
1
2
3
4
5
...
1
 
2
3
4
0
@@ -1,5 +1,4 @@
0
 dir = File.dirname(__FILE__)
0
-ARGV.push('--require', "#{dir}/spec_helpers/indented_text_formatter", '--options', "#{dir}/spec.opts")
0
 
0
 Dir["#{dir}/{models,fixture_specs,views,controllers,helpers}/**/*_spec.rb"].each do |file|
0
   require file
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 ---
0
 format: 1
0
 handler:
0
- commit: 8d86e0a630ad6c3529f0c17f12fb73abbfb9ba14
0
+ commit: d5180adac27ffd4abe58aca9d448a9cd9ca711d5
0
 repository_url: git://github.com/dchelimsky/rspec-rails.git
0
 lock: false
0
 repository_class: Piston::Git::Repository
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper'
0
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
0
 
0
 describe <%= class_name %>Controller do
0
 
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper'
0
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
0
 
0
 describe <%= class_name %>Helper do
0
   
...
1
 
2
3
4
...
7
8
9
10
 
11
12
...
 
1
2
3
4
...
7
8
9
 
10
11
12
0
@@ -1,4 +1,4 @@
0
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper'
0
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
0
 
0
 describe "/<%= class_name.underscore %>/<%= action %>" do
0
   before(:each) do
0
@@ -7,7 +7,7 @@
0
   
0
   #Delete this example and add some real ones or delete this file
0
   it "should tell you where to find the file" do
0
- response.should have_tag('p', /Find me in app\/views\/<%= class_name.underscore %>\/<%= action %>/)
0
+ response.should have_tag('p', %r[Find me in app/views/<%= class_name.underscore %>/<%= action %>])
0
   end
0
 end
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper'
0
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
0
 
0
 describe <%= class_name %> do
0
   before(:each) do
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper'
0
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
0
 
0
 describe <%= controller_class_name %>Controller do
0
   describe "handling GET /<%= table_name %>" do
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper'
0
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
0
 
0
 describe "/<%= table_name %>/edit.<%= default_file_extension %>" do
0
   include <%= controller_class_name %>Helper
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper'
0
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
0
 
0
 describe <%= controller_class_name %>Helper do
0
   
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper'
0
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
0
 
0
 describe "/<%= table_name %>/index.<%= default_file_extension %>" do
0
   include <%= controller_class_name %>Helper
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper'
0
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
0
 
0
 describe "/<%= table_name %>/new.<%= default_file_extension %>" do
0
   include <%= controller_class_name %>Helper
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper'
0
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../spec_helper')
0
 
0
 describe <%= controller_class_name %>Controller do
0
   describe "route generation" do
...
1
 
2
3
4
...
 
1
2
3
4
0
@@ -1,4 +1,4 @@
0
-require File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper'
0
+require File.expand_path(File.dirname(__FILE__) + '<%= '/..' * class_nesting_depth %>/../../spec_helper')
0
 
0
 describe "/<%= table_name %>/show.<%= default_file_extension %>" do
0
   include <%= controller_class_name %>Helper
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 module Spec
0
   module Rails
0
     module VERSION #:nodoc:
0
- BUILD_TIME_UTC = 20080504004334
0
+ BUILD_TIME_UTC = 20080522075859
0
     end
0
   end
0
 end
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 ---
0
 format: 1
0
 handler:
0
- commit: fa5228c4213849870231b0da371ddbef39a4982d
0
+ commit: e1bce2b4517a206dd08313652cf2f0b0cf740d4f
0
 repository_url: git://github.com/dchelimsky/rspec.git
0
 lock: false
0
 repository_class: Piston::Git::Repository
...
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
...
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
 
22
 
 
 
 
23
24
25
...
4
5
6
 
 
 
 
 
 
7
 
 
 
 
 
 
 
 
8
9
10
11
12
13
14
15
16
17
0
@@ -4,22 +4,14 @@
0
   module Runner
0
     module Formatter
0
       class FailingExampleGroupsFormatter < BaseTextFormatter
0
- attr_reader :example_group
0
- def add_example_group(example_group)
0
- super
0
- @example_group = example_group
0
- end
0
-
0
         def example_failed(example, counter, failure)
0
- if @example_group
0
- description_parts = @example_group.description_parts.collect do |description|
0
- description =~ /(.*) \(druby.*\)$/ ? $1 : description
0
- end
0
- @output.puts ::Spec::Example::ExampleGroupMethods.description_text(*description_parts)
0
-
0
- @output.flush
0
- @example_group = nil
0
+ description_parts = @example_group.description_parts.collect do |description|
0
+ description =~ /(.*) \(druby.*\)$/ ? $1 : description
0
           end
0
+ @output.puts ::Spec::Example::ExampleGroupMethods.description_text(*description_parts)
0
+
0
+ @output.flush
0
+ @example_group = nil
0
         end
0
 
0
         def dump_failure(counter, failure)
...
9
10
11
12
13
 
 
14
15
16
17
...
18
19
20
21
22
 
 
23
24
25
26
27
 
 
28
29
30
31
...
39
40
41
42
43
 
 
44
45
46
47
48
49
 
50
51
52
...
57
58
59
60
 
61
62
63
...
71
72
73
74
 
75
76
77
...
87
88
89
90
 
91
92
93
...
110
111
112
113
 
114
115
116
...
9
10
11
 
 
12
13
14
15
16
17
...
18
19
20
 
 
21
22
23
24
25
 
 
26
27
28
29
30
31
...
39
40
41
 
 
42
43
44
45
46
47
48
 
49
50
51
52
...
57
58
59
 
60
61
62
63
...
71
72
73
 
74
75
76
77
...
87
88
89
 
90
91
92
93
...
110
111
112
 
113
114
115
116
0
@@ -9,8 +9,8 @@
0
         
0
         def initialize(options, output)
0
           super
0
- @current_example_group_number = 0
0
- @current_example_number = 0
0
+ @example_group_number = 0
0
+ @example_number = 0
0
         end
0
         
0
         def method_missing(sym, *args)
0
0
@@ -18,13 +18,13 @@
0
         end
0
 
0
         # The number of the currently running example_group
0
- def current_example_group_number
0
- @current_example_group_number
0
+ def example_group_number
0
+ @example_group_number
0
         end
0
         
0
         # The number of the currently running example (a global counter)
0
- def current_example_number
0
- @current_example_number
0
+ def example_number
0
+ @example_number
0
         end
0
         
0
         def start(example_count)
0
0
@@ -39,14 +39,14 @@
0
           super
0
           @example_group_red = false
0
           @example_group_red = false
0
- @current_example_group_number += 1
0
- unless current_example_group_number == 1
0
+ @example_group_number += 1
0
+ unless example_group_number == 1
0
             @output.puts " </dl>"
0
             @output.puts "</div>"
0
           end
0
           @output.puts "<div class=\"example_group\">"
0
           @output.puts " <dl>"
0
- @output.puts " <dt id=\"example_group_#{current_example_group_number}\">#{h(example_group.description)}</dt>"
0
+ @output.puts " <dt id=\"example_group_#{example_group_number}\">#{h(example_group.description)}</dt>"
0
           @output.flush
0
         end
0
 
0
@@ -57,7 +57,7 @@
0
         end
0
 
0
         def example_started(example)
0
- @current_example_number += 1
0
+ @example_number += 1
0
         end
0
 
0
         def example_passed(example)
0
@@ -71,7 +71,7 @@
0
           failure_style = failure.pending_fixed? ? 'pending_fixed' : 'failed'
0
           @output.puts " <script type=\"text/javascript\">makeRed('rspec-header');</script>" unless @header_red
0
           @header_red = true
0
- @output.puts " <script type=\"text/javascript\">makeRed('example_group_#{current_example_group_number}');</script>" unless @example_group_red
0
+ @output.puts " <script type=\"text/javascript\">makeRed('example_group_#{example_group_number}');</script>" unless @example_group_red
0
           @example_group_red = true
0
           move_progress
0
           @output.puts " <dd class=\"spec #{failure_style}\">"
0
@@ -87,7 +87,7 @@
0
 
0
         def example_pending(example, message)
0
           @output.puts " <script type=\"text/javascript\">makeYellow('rspec-header');</script>" unless @header_red
0
- @output.puts " <script type=\"text/javascript\">makeYellow('example_group_#{current_example_group_number}');</script>" unless @example_group_red
0
+ @output.puts " <script type=\"text/javascript\">makeYellow('example_group_#{example_group_number}');</script>" unless @example_group_red
0
           move_progress
0
           @output.puts " <dd class=\"spec not_implemented\"><span class=\"not_implemented_spec_name\">#{h(example.description)} (PENDING: #{h(message)})</span></dd>"
0
           @output.flush
0
@@ -110,7 +110,7 @@
0
         def percent_done
0
           result = 100.0
0
           if @example_count != 0
0
- result = ((current_example_number).to_f / @example_count.to_f * 1000).to_i / 10.0
0
+ result = ((example_number).to_f / @example_count.to_f * 1000).to_i / 10.0
0
           end
0
           result
0
         end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
0
@@ -1 +1,49 @@
0
+require 'spec/runner/formatter/base_text_formatter'
0
+
0
+module Spec
0
+ module Runner
0
+ module Formatter
0
+ class IndentedTextFormatter < BaseTextFormatter
0
+ def add_example_group(example_group)
0
+ super
0
+ if example_group.description_args && !example_group.description_args.empty?
0
+ output.puts "#{example_group_indentation(example_group)}#{example_group.description_args}"
0
+ output.flush
0
+ end
0
+ end
0
+
0
+ def example_failed(example, counter, failure)
0
+ message = if failure.expectation_not_met?
0
+ "#{example_group_indentation(example.class)} #{example.description} (FAILED - #{counter})"
0
+ else
0
+ "#{example_group_indentation(example.class)} #{example.description} (ERROR - #{counter})"
0
+ end
0
+
0
+ output.puts(failure.expectation_not_met? ? red(message) : magenta(message))
0
+ output.flush
0
+ end
0
+
0
+ def example_passed(example)
0
+ message = "#{example_group_indentation(example.class)} #{example.description}"
0
+ output.puts green(message)
0
+ output.flush
0
+ end
0
+
0
+ def example_pending(example, message)
0
+ super
0
+ output.puts yellow("#{example_group_indentation(example.class)} #{example.description} (PENDING: #{message})")
0
+ output.flush
0
+ end
0
+
0
+ def example_group_indentation(example_group)
0
+ example_group_chain = []
0
+ example_group.send(:execute_in_class_hierarchy) do |parent_example_group|
0
+ example_group_chain << parent_example_group if parent_example_group.description_args
0
+ end
0
+ ' ' * (example_group_chain - [example_group]).length
0
+ end
0
+ end
0
+ end
0
+ end
0
+end
...
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 = 20080504004334
0
+ BUILD_TIME_UTC = 20080522075859
0
 
0
       STRING = [MAJOR, MINOR, TINY].join('.')
0
       TAG = "REL_#{[MAJOR, MINOR, TINY, RELEASE_CANDIDATE].compact.join('_')}".upcase.gsub(/\.|-/, '_')
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198<