Class: ActiveRecordFormatterBase

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/activerecord/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(summary, collector) ⇒ ActiveRecordFormatterBase

Returns a new instance of ActiveRecordFormatterBase.



4
5
6
7
8
# File 'lib/rspec/activerecord/base.rb', line 4

def initialize(summary, collector)
  @colorizer  = ::RSpec::Core::Formatters::ConsoleCodes
  @summary    = summary
  @collector  = collector
end

Instance Attribute Details

#collectorObject (readonly)

Returns the value of attribute collector.



2
3
4
# File 'lib/rspec/activerecord/base.rb', line 2

def collector
  @collector
end

#colorizerObject (readonly)

Returns the value of attribute colorizer.



2
3
4
# File 'lib/rspec/activerecord/base.rb', line 2

def colorizer
  @colorizer
end

#summaryObject (readonly)

Returns the value of attribute summary.



2
3
4
# File 'lib/rspec/activerecord/base.rb', line 2

def summary
  @summary
end

Instance Method Details

#colorized_summaryObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rspec/activerecord/base.rb', line 10

def colorized_summary
  formatted = "\nFinished in #{summary.formatted_duration} " \
    "(files took #{summary.formatted_load_time} to load)\n" \
    "#{colorized_expanded_totals}\n"

  unless summary.failed_examples.empty?
    formatted << summary.colorized_rerun_commands(colorizer) << "\n"
  end

  formatted
end