Class: Cadre::RSpec3::QuickfixFormatter
- Inherits:
-
Object
- Object
- Cadre::RSpec3::QuickfixFormatter
- Defined in:
- lib/cadre/rspec3/quickfix-formatter.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
- #example_failed(notification) ⇒ Object
- #example_pending(example) ⇒ Object
-
#initialize(output) ⇒ QuickfixFormatter
constructor
TODO: vim-side function for printing progress (if that’s even possible).
Constructor Details
#initialize(output) ⇒ QuickfixFormatter
TODO: vim-side function for printing progress (if that’s even possible)
12 13 14 15 |
# File 'lib/cadre/rspec3/quickfix-formatter.rb', line 12 def initialize(output) @config = Config.new(Valise, "quickfix") @output = File::open(@config.output_path, "w") end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
16 17 18 |
# File 'lib/cadre/rspec3/quickfix-formatter.rb', line 16 def config @config end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
16 17 18 |
# File 'lib/cadre/rspec3/quickfix-formatter.rb', line 16 def output @output end |
Instance Method Details
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/cadre/rspec3/quickfix-formatter.rb', line 43 def dump_summary(duration, example_count, failure_count, pending_count) @duration = duration @example_count = example_count @failure_count = failure_count @pending_count = pending_count end |
#example_failed(notification) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cadre/rspec3/quickfix-formatter.rb', line 20 def example_failed(notification) example = notification.example exception = example.execution_result.exception paths = exception.backtrace.map do |frame| format_caller frame end.compact paths = paths[0..config.backtrace_limit] = "#{example.full_description}: #{ exception.}" paths.each do |path| output.puts "#{path}: [FAIL] #{}" end end |
#example_pending(example) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/cadre/rspec3/quickfix-formatter.rb', line 34 def example_pending(example) return unless config.include_pending? example = notification.example = example.execution_result[:pending_message] path = format_caller example.location output.puts "#{path}: [PEND] #{}" if path end |