bdd 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +9 -5
- data/README.md +72 -224
- data/bdd.gemspec +6 -12
- data/examples/README.md +244 -0
- data/examples/minitest/abc_test.rb +58 -0
- data/examples/rspec/abc_spec.rb +58 -0
- data/examples/rspec/examples_with_shared_code/README.txt +1 -0
- data/examples/rspec/examples_with_shared_code/basic_spec.rb +42 -0
- data/examples/rspec/examples_with_shared_code/shared_1_spec.rb +40 -0
- data/examples/rspec/examples_with_shared_code/shared_2_spec.rb +40 -0
- data/examples/rspec/zombie_example_spec.rb +59 -0
- data/lib/bdd.rb +10 -13
- data/lib/bdd/adapters.rb +7 -0
- data/lib/bdd/adapters/base.rb +47 -0
- data/lib/bdd/adapters/minitest_adapter.rb +56 -0
- data/lib/bdd/adapters/rspec_adapter.rb +75 -0
- data/lib/bdd/check.rb +50 -0
- data/lib/bdd/class_methods.rb +22 -0
- data/lib/bdd/colors.rb +34 -0
- data/lib/bdd/minitest.rb +13 -0
- data/lib/bdd/rspec.rb +8 -3
- data/lib/bdd/string_builder.rb +22 -0
- data/lib/bdd/title.rb +22 -0
- data/lib/bdd/version.rb +1 -1
- metadata +42 -12
- data/.rspec +0 -2
- data/lib/bdd/rspec/example_group.rb +0 -107
- data/lib/bdd/rspec/formatter.rb +0 -73
data/lib/bdd/rspec/formatter.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
RSpec::Support.require_rspec_core "formatters/documentation_formatter"
|
2
|
-
|
3
|
-
module Bdd
|
4
|
-
module RSpec
|
5
|
-
class Formatter < ::RSpec::Core::Formatters::DocumentationFormatter
|
6
|
-
|
7
|
-
::RSpec::Core::Formatters.register self, :example_group_started, :example_group_finished,
|
8
|
-
:example_started, :example_passed,
|
9
|
-
:example_pending, :example_failed
|
10
|
-
|
11
|
-
def example_started(notification)
|
12
|
-
notification.example.metadata[:step_messages] = []
|
13
|
-
end
|
14
|
-
|
15
|
-
def example_passed(passed)
|
16
|
-
super
|
17
|
-
output.puts read_steps(passed.example)
|
18
|
-
end
|
19
|
-
|
20
|
-
def example_pending(pending)
|
21
|
-
super
|
22
|
-
output.puts read_steps(pending.example, :yellow)
|
23
|
-
end
|
24
|
-
|
25
|
-
def example_failed(failure)
|
26
|
-
super
|
27
|
-
output.puts read_steps(failure.example, :red)
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def read_steps(example, color2=nil)
|
33
|
-
last_step_title = ""
|
34
|
-
example.metadata[:step_messages].map do |hash|
|
35
|
-
msg = hash[:msg]
|
36
|
-
color = hash[:color] || color2 || :light_black
|
37
|
-
if msg.is_a? Array
|
38
|
-
msg0 = if msg[0] == last_step_title
|
39
|
-
blank_step_title
|
40
|
-
else
|
41
|
-
text_with_color(msg[0], :white)
|
42
|
-
end
|
43
|
-
last_step_title = msg[0]
|
44
|
-
|
45
|
-
msg = [msg0, text_with_color(msg[1], color)].join(' ')
|
46
|
-
end
|
47
|
-
# light_black doesn't really get used because the test failure prevents other messages from being added
|
48
|
-
r = [next_indentation, msg]
|
49
|
-
r.join(' ')
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def blank_step_title
|
54
|
-
" "
|
55
|
-
end
|
56
|
-
|
57
|
-
def next_indentation
|
58
|
-
' ' * (@group_level+1)
|
59
|
-
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
def text_with_color(text, color)
|
64
|
-
if ::RSpec.configuration.color_enabled?
|
65
|
-
text.colorize(color)
|
66
|
-
else
|
67
|
-
text
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|