cadre 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a25f0e84a0418dbdee6abf6ce0c9be69e0830a82
|
4
|
+
data.tar.gz: 4a2ff3bc4326c9041ac499ee5e37804c5a961a88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10885f2739a644f50c53f287d067eaee6433f6d13f3b450c3cbbf5b59c5155f27cdbdcba44b400c69a1cc24e074e6619e862da802c98968d05714b708a910ecb
|
7
|
+
data.tar.gz: d24ad7d72999c2859f7bf6170cc0cb89c0a51163cdaec8787295380fc8d1d96dde3bcf1ea75b5b8e9fb4debe0e905de8a387ea6896458552febc8388cfc3df1a
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'cadre/notifier'
|
2
|
+
require 'rspec/core/formatters/base_formatter'
|
3
|
+
|
4
|
+
rspec_pid = Process.pid
|
5
|
+
at_exit do
|
6
|
+
if Process.pid == rspec_pid and not($!.nil? or $!.is_a?(SystemExit))
|
7
|
+
message = "Exception:\n#{$!.inspect}\n#{Dir.pwd}"
|
8
|
+
Cadre::Notifier.get.new do |notifier|
|
9
|
+
notifier.summary = "Spec run exited unexpectedly"
|
10
|
+
notifier.message = message
|
11
|
+
notifier.expire_time = 5000
|
12
|
+
notifier.sound = "error"
|
13
|
+
end.go
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module Cadre
|
18
|
+
module RSpec3
|
19
|
+
class NotifyOnCompleteFormatter
|
20
|
+
def notify_message(duration, example_count, failure_count, pending_count)
|
21
|
+
"Total duration: #{duration}\n Total: #{example_count}\n Failed: #{failure_count}\n Pending: #{pending_count}\n\nFinished at #{Time.now}"
|
22
|
+
end
|
23
|
+
|
24
|
+
::RSpec::Core::Formatters.register self, :dump_summary
|
25
|
+
|
26
|
+
def initialize(output)
|
27
|
+
end
|
28
|
+
|
29
|
+
def dump_summary(summary)
|
30
|
+
duration = summary.duration
|
31
|
+
example_count = summary.examples.length
|
32
|
+
failure_count = summary.failed_examples.length
|
33
|
+
pending_count = summary.pending_examples.length
|
34
|
+
|
35
|
+
notifier = Cadre::Notifier.get.new
|
36
|
+
|
37
|
+
if duration < 20
|
38
|
+
notifier.transient = true
|
39
|
+
notifier.summary = "Finished spec run"
|
40
|
+
notifier.message = notify_message(duration, example_count, failure_count, pending_count)
|
41
|
+
else
|
42
|
+
notifier.summary = "Finished long spec run"
|
43
|
+
notifier.message = notify_message(duration, example_count, failure_count, pending_count)
|
44
|
+
end
|
45
|
+
if failure_count > 0
|
46
|
+
notifier.sound = "failure"
|
47
|
+
else
|
48
|
+
notifier.sound = "success"
|
49
|
+
end
|
50
|
+
notifier.go
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# !!! Lifted wholesale from
|
2
|
+
# https://wincent.com/blog/running-rspec-specs-from-inside-vim
|
3
|
+
require 'rspec/core/formatters/base_text_formatter'
|
4
|
+
require 'cadre/config'
|
5
|
+
|
6
|
+
module Cadre
|
7
|
+
module RSpec3
|
8
|
+
class QuickfixFormatter
|
9
|
+
|
10
|
+
# TODO: vim-side function for printing progress (if that's even possible)
|
11
|
+
#
|
12
|
+
def initialize(output)
|
13
|
+
@config = Config.new(Valise, "quickfix")
|
14
|
+
@output = File::open(@config.output_path, "w")
|
15
|
+
end
|
16
|
+
attr_reader :output, :config
|
17
|
+
|
18
|
+
::RSpec::Core::Formatters.register self, :example_failed, :example_pending
|
19
|
+
|
20
|
+
def example_failed(notification)
|
21
|
+
example = notification.example
|
22
|
+
|
23
|
+
exception = example.execution_result.exception
|
24
|
+
paths = exception.backtrace.map do |frame|
|
25
|
+
format_caller frame
|
26
|
+
end.compact
|
27
|
+
paths = paths[0..config.backtrace_limit]
|
28
|
+
message = "#{example.full_description}: #{format_message exception.message}"
|
29
|
+
paths.each do |path|
|
30
|
+
output.puts "#{path}: [FAIL] #{message}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def example_pending(example)
|
35
|
+
return unless config.include_pending?
|
36
|
+
example = notification.example
|
37
|
+
|
38
|
+
message = format_message example.execution_result[:pending_message]
|
39
|
+
path = format_caller example.location
|
40
|
+
output.puts "#{path}: [PEND] #{message}" if path
|
41
|
+
end
|
42
|
+
|
43
|
+
def dump_summary(duration, example_count, failure_count, pending_count)
|
44
|
+
@duration = duration
|
45
|
+
@example_count = example_count
|
46
|
+
@failure_count = failure_count
|
47
|
+
@pending_count = pending_count
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
def format_caller(caller_info)
|
53
|
+
RSpec.configuration.backtrace_formatter.backtrace_line(caller_info.to_s.split(':in `block').first)
|
54
|
+
end
|
55
|
+
|
56
|
+
def format_message(msg)
|
57
|
+
# NOTE: may consider compressing all whitespace here
|
58
|
+
msg.gsub("\n", ' ')[0,40]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Cadre::RSpec3
|
2
|
+
class TrueFeelingsFormatter < RSpec::Core::Formatters::BaseFormatter
|
3
|
+
include ::RSpec::Core::Formatters::ConsoleCodes
|
4
|
+
|
5
|
+
::RSpec::Core::Formatters.register self, :example_passed, :example_failed
|
6
|
+
|
7
|
+
def initialize(output)
|
8
|
+
super
|
9
|
+
@any_fails_yet = false
|
10
|
+
end
|
11
|
+
|
12
|
+
def example_failed(notification)
|
13
|
+
@any_fails_yet = true
|
14
|
+
end
|
15
|
+
|
16
|
+
def example_passed(example)
|
17
|
+
unless @any_fails_yet
|
18
|
+
super
|
19
|
+
else
|
20
|
+
output.print wrap("u", :failure)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Uuu = Cadre::RSpec3::TrueFeelingsFormatter
|
data/lib/cadre/rspec3.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cadre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Judson Lester
|
@@ -87,6 +87,10 @@ files:
|
|
87
87
|
- lib/cadre/rspec/quickfix-formatter.rb
|
88
88
|
- lib/cadre/rspec/notify-on-complete-formatter.rb
|
89
89
|
- lib/cadre/rspec/true-feelings-formatter.rb
|
90
|
+
- lib/cadre/rspec3.rb
|
91
|
+
- lib/cadre/rspec3/quickfix-formatter.rb
|
92
|
+
- lib/cadre/rspec3/notify-on-complete-formatter.rb
|
93
|
+
- lib/cadre/rspec3/true-feelings-formatter.rb
|
90
94
|
- lib/cadre/config.rb
|
91
95
|
- lib/cadre/command-line.rb
|
92
96
|
- lib/cadre/valise.rb
|
@@ -107,7 +111,7 @@ rdoc_options:
|
|
107
111
|
- --main
|
108
112
|
- doc/README
|
109
113
|
- --title
|
110
|
-
- cadre-0.3.
|
114
|
+
- cadre-0.3.1 Documentation
|
111
115
|
require_paths:
|
112
116
|
- lib/
|
113
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|