Class: RailsInfo::Logs::Test::RspecPresenter
- Defined in:
- app/presenters/rails_info/logs/test/rspec_presenter.rb
Instance Method Summary collapse
- #accordion ⇒ Object
-
#initialize(subject, options = {}) ⇒ RspecPresenter
constructor
A new instance of RspecPresenter.
- #summary ⇒ Object
Methods inherited from Presenter
Constructor Details
#initialize(subject, options = {}) ⇒ RspecPresenter
Returns a new instance of RspecPresenter.
2 3 4 5 6 7 8 |
# File 'app/presenters/rails_info/logs/test/rspec_presenter.rb', line 2 def initialize(subject, = {}) super(subject, ) @rails_info_log = ::RailsInfo::Logs::Test::Rspec.new( log: [:log], debug: [:debug] ) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RailsInfo::Presenter
Instance Method Details
#accordion ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/presenters/rails_info/logs/test/rspec_presenter.rb', line 17 def accordion @index = 0 if @rails_info_log.hash.is_a?(Hash) content_tag :div, id: 'files', class: 'accordions' do html = '' @rails_info_log.hash.each do |file, examples| file_presenter = ::RailsInfo::Logs::Test::Rspec::FilePresenter.new( @subject, name: "#{file} (#{examples.length})", tabs_data: examples, index: @index, rails_root: @rails_info_log.rails_root ) @index += 1 html += raw file_presenter.tabs end raw html end else content_tag :pre, @rails_info_log.hash.join("\n") end end |
#summary ⇒ Object
10 11 12 13 14 15 |
# File 'app/presenters/rails_info/logs/test/rspec_presenter.rb', line 10 def summary text = ["#{@rails_info_log.number_of_files} files"] text << @rails_info_log.summary unless @rails_info_log.summary.blank? content_tag :p, text.join(', ') end |