rspec-compact-doc-formatter 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,10 +25,10 @@ class RspecCompactDocFormatter < RSpec::Core::Formatters::BaseTextFormatter
25
25
 
26
26
  if @group_level == 0
27
27
  output_class_name description
28
- elsif method_name?(description)
28
+ elsif method_name? description
29
29
  output_prelude_and_method description
30
30
  elsif @method_position and @group_level > @method_position
31
- nil
31
+ output_fixture description
32
32
  else
33
33
  @prelude += description + ' '
34
34
  end
@@ -73,9 +73,9 @@ class RspecCompactDocFormatter < RSpec::Core::Formatters::BaseTextFormatter
73
73
 
74
74
  if example_group
75
75
  example_group.ancestors.reverse.each_with_index do |a, i|
76
- if i <= @method_position
76
+ if i <= @start_position
77
77
  nil
78
- elsif i != @method_position + 1 and a.description[0,4] == 'when'
78
+ elsif i != @start_position + 1 and a.description[0,4] == 'when'
79
79
  content[:assertion] << ", #{a.description}"
80
80
  elsif not ['and', 'having', 'when', 'with', 'without'].include? a.description.split(' ')[0] and (i+1) == example_group.ancestors.length
81
81
  content[:subject] = a.description
@@ -90,7 +90,7 @@ class RspecCompactDocFormatter < RSpec::Core::Formatters::BaseTextFormatter
90
90
 
91
91
  content[:result] = example.description.to_s.empty? ? 'FAILED' : example.description
92
92
 
93
- return (@method_position == 1 ? ' ' : ' ') + content[:assertion].join + content[:subject] + self.send(color, content[:result])
93
+ return (@start_position == 1 ? ' ' : ' ') + content[:assertion].join + content[:subject] + self.send(color, content[:result])
94
94
  end
95
95
 
96
96
  def output_class_name(description)
@@ -98,6 +98,14 @@ class RspecCompactDocFormatter < RSpec::Core::Formatters::BaseTextFormatter
98
98
  @prelude = ''
99
99
  end
100
100
 
101
+ def output_fixture(description)
102
+ if description.include? 'with the fixture'
103
+ @start_position += 1
104
+
105
+ output.puts current_indentation + description.split(':')[0] + "\e[1;33m" + description.split(':')[1] + "\e[0m"
106
+ end
107
+ end
108
+
101
109
  def output_prelude_and_method(description)
102
110
  indent_method = @prelude.empty? ? ' ' : ' '
103
111
 
@@ -117,6 +125,7 @@ class RspecCompactDocFormatter < RSpec::Core::Formatters::BaseTextFormatter
117
125
  output.puts indent_method + cyan(description)
118
126
 
119
127
  @method_position = @group_level
128
+ @start_position = @method_position
120
129
  end
121
130
 
122
131
  def passed_output(example)
@@ -124,7 +133,7 @@ class RspecCompactDocFormatter < RSpec::Core::Formatters::BaseTextFormatter
124
133
  end
125
134
 
126
135
  def pending_output(example, message)
127
- indent = (@method_position and @method_position > 1) ? ' ' : ' '
136
+ indent = (@start_position and @start_position > 1) ? ' ' : ' '
128
137
  yellow("#{indent}#{example.description} (PENDING: #{message})")
129
138
  end
130
139
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-compact-doc-formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-07 00:00:00.000000000 Z
12
+ date: 2012-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &2165248860 !ruby/object:Gem::Requirement
16
+ requirement: &2152922720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.8.7
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2165248860
24
+ version_requirements: *2152922720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2165248200 !ruby/object:Gem::Requirement
27
+ requirement: &2152922100 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '2.0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2165248200
35
+ version_requirements: *2152922100
36
36
  description: Compact yet descriptive Rspec format.
37
37
  email:
38
38
  - sebastien@demarque.com