lucian 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fecef164827cd45fc4f11bbf40fedadb8c1c79c
4
- data.tar.gz: 1278fc332a19f5b54e71708bcc4b6b78475d4c96
3
+ metadata.gz: a4db5bd34779a0ebf839a2508d5be8946b6a615e
4
+ data.tar.gz: c45ab073249fc954b42485ed2cfba509668d2bf7
5
5
  SHA512:
6
- metadata.gz: cc42699773452aeff0f335ed9b8cb15709edf08bf6f603b869dd8a431604f93756b4a0c23d3143490894719d44a8bcb60ecb86ad1bcc9e2984029841ea66edd9
7
- data.tar.gz: 69ac22f9e78fb085391f59fbb8537afce84044b86b8dd646c5413b40c8d09c0cce95066d8992f3b10addcf9c808f35ca4c996f8944ff0db7badc65294c6bc9b9
6
+ metadata.gz: 4e8b9470b1c06b3118c0cdf32fefd417ba93c7777e3adee984e6c61c4c3832dcb1c5a85b1164d331ba5dc9386e7057c1c07c8976ea3b1c171cf08319838c072a
7
+ data.tar.gz: 01f01d97c96e8f47236725cad42d9b37fc367b9d213cb8097f1fd099d72ac8ab7e2a70274db64a46ca43e73825c28c0903d1d4d58abbacff67ade9e426c52f5c
@@ -0,0 +1,74 @@
1
+ require 'rspec/core/formatters/console_codes'
2
+
3
+ module Lucian
4
+ class CustomFormatter
5
+ RSpec::Core::Formatters.register self, :dump_pending, :dump_failures, :close,
6
+ :dump_summary, :example_passed, :example_failed, :example_pending
7
+
8
+ def initialize output
9
+ @output = output
10
+ end
11
+
12
+ def example_passed notification
13
+ @output << RSpec::Core::Formatters::ConsoleCodes.wrap("\nPASSED", :success)
14
+ end
15
+
16
+ def example_failed notification
17
+ @output << RSpec::Core::Formatters::ConsoleCodes.wrap("\nFAILED", :failure)
18
+ end
19
+
20
+ def example_pending notification
21
+ @output << RSpec::Core::Formatters::ConsoleCodes.wrap("\nPENDED", :pending)
22
+ end
23
+
24
+ def dump_pending notification
25
+ if notification.pending_examples.length > 0
26
+ @output << "\n\n#{RSpec::Core::Formatters::ConsoleCodes.wrap("PENDING:", :pending)}\n"
27
+ @output << notification.pending_examples.map {|example| "|=:" + example.full_description + ":|-|:" + example.location + ":=|" }.join("\n")
28
+ end
29
+ end
30
+
31
+ def dump_failures notification
32
+ if notification.failed_examples.length > 0
33
+ @output << "\n#{RSpec::Core::Formatters::ConsoleCodes.wrap("FAILING:", :failure)}\n"
34
+ @output << failed_examples_output(notification)
35
+ end
36
+ end
37
+
38
+ def dump_summary notification
39
+ @output << "\n\nFinished in #{RSpec::Core::Formatters::Helpers.format_duration(notification.duration)}."
40
+ end
41
+
42
+ def close notification
43
+ @output << "\n"
44
+ end
45
+
46
+ private
47
+
48
+ def failed_examples_output notification
49
+ failed_examples_output = notification.failed_examples.map do |example|
50
+ failed_example_output example
51
+ end
52
+ build_examples_output(failed_examples_output)
53
+ end
54
+
55
+ def build_examples_output output
56
+ output.join("\n\n")
57
+ end
58
+
59
+ def failed_example_output example
60
+ full_description = example.full_description
61
+ location = example.location
62
+ formatted_message = strip_message_from_whitespace(example.execution_result.exception.message)
63
+ "|=:#{full_description}:|-|:#{location}:|-|:#{formatted_message}:=|"
64
+ end
65
+
66
+ def strip_message_from_whitespace msg
67
+ msg.split("\n").map(&:strip).join("\n")
68
+ end
69
+
70
+ def add_spaces n
71
+ " " * n
72
+ end
73
+ end
74
+ end
@@ -1,3 +1,3 @@
1
1
  module Lucian
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanapat Sainak
@@ -173,6 +173,7 @@ files:
173
173
  - lib/docker/compose/session.rb
174
174
  - lib/lucian.rb
175
175
  - lib/lucian/board_caster.rb
176
+ - lib/lucian/custom_formatter.rb
176
177
  - lib/lucian/engine.rb
177
178
  - lib/lucian/errors.rb
178
179
  - lib/lucian/initiator.rb