Class: Cadre::RSpec::QuickfixFormatter
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- Cadre::RSpec::QuickfixFormatter
- Defined in:
- lib/cadre/rspec/quickfix-formatter.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #dump_failures(*args) ⇒ Object
- #dump_pending(*args) ⇒ Object
- #dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
- #example_failed(example) ⇒ Object
- #example_pending(example) ⇒ Object
-
#initialize(output) ⇒ QuickfixFormatter
constructor
TODO: vim-side function for printing progress (if that’s even possible).
- #message(msg) ⇒ Object
Constructor Details
#initialize(output) ⇒ QuickfixFormatter
TODO: vim-side function for printing progress (if that’s even possible)
12 13 14 15 16 |
# File 'lib/cadre/rspec/quickfix-formatter.rb', line 12 def initialize(output) super(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.
17 18 19 |
# File 'lib/cadre/rspec/quickfix-formatter.rb', line 17 def config @config end |
Instance Method Details
#dump_failures(*args) ⇒ Object
38 |
# File 'lib/cadre/rspec/quickfix-formatter.rb', line 38 def dump_failures(*args); end |
#dump_pending(*args) ⇒ Object
40 |
# File 'lib/cadre/rspec/quickfix-formatter.rb', line 40 def dump_pending(*args); end |
#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/cadre/rspec/quickfix-formatter.rb', line 44 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(example) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cadre/rspec/quickfix-formatter.rb', line 19 def example_failed(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
31 32 33 34 35 36 |
# File 'lib/cadre/rspec/quickfix-formatter.rb', line 31 def example_pending(example) return unless config.include_pending? = example.execution_result[:pending_message] path = format_caller example.location output.puts "#{path}: [PEND] #{}" if path end |
#message(msg) ⇒ Object
42 |
# File 'lib/cadre/rspec/quickfix-formatter.rb', line 42 def (msg); end |