Sha256: e4fbe5bbb86207d900de062c5e8eb67c854be8715fba4ef7e616aad24bf880ff

Contents?: true

Size: 989 Bytes

Versions: 2

Compression:

Stored size: 989 Bytes

Contents

module StatusRenderingVerbosity
  class << self
    delegate :visible_expectation_results, :render_feedback?, to: :current
  end

  def self.current
    @current ||=  "StatusRenderingVerbosity::#{Rails.configuration.status_rendering_verbosity.capitalize}".constantize
  end

  module Verbose
    def self.visible_expectation_results(_status_like, expectation_results)
      expectation_results
    end

    def self.render_feedback?(feedback)
      feedback.present?
    end
  end

  module Standard
    def self.visible_expectation_results(status_like, expectation_results)
      if status_like.to_mumuki_status.errored?
        []
      else
        expectation_results.select { |it| it[:result].failed? }
      end
    end

    def self.render_feedback?(feedback)
      feedback.present?
    end
  end

  module Silent
    def self.visible_expectation_results(_status_like, _expectation_results)
      []
    end

    def self.render_feedback?(_feedback)
      false
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mumuki-laboratory-5.2.1 app/models/status_rendering_verbosity.rb
mumuki-laboratory-5.2.0 app/models/status_rendering_verbosity.rb