Sha256: 4fff55f6e01a0acd833869b535a75f71f3603a6b2f566e9ce7c24b30a60dd44c

Contents?: true

Size: 1.44 KB

Versions: 6

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

require_relative "printers/base"
require_relative "printers/error"
require_relative "printers/failure"
require_relative "printers/null"
require_relative "printers/success"

module ConvenientService
  module RSpec
    module Matchers
      module Classes
        module Results
          class Base
            module Entities
              module Printers
                class << self
                  ##
                  # @api private
                  #
                  # @param matcher [ConvenientService::RSpec::Matchers::Classes::Results::Base]
                  # @return [ConvenientService::RSpec::Matchers::Classes::Results::Base::Entities::Printers::Base]
                  #
                  def create(matcher:)
                    return Entities::Printers::Null.new(matcher: matcher) unless matcher.result

                    case matcher.result.status.to_sym
                    when :success
                      Entities::Printers::Success.new(matcher: matcher)
                    when :failure
                      Entities::Printers::Failure.new(matcher: matcher)
                    when :error
                      Entities::Printers::Error.new(matcher: matcher)
                    else
                      Entities::Printers::Null.new(matcher: matcher)
                    end
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/rspec/matchers/classes/results/base/entities/printers.rb
convenient_service-0.19.0 lib/convenient_service/rspec/matchers/classes/results/base/entities/printers.rb
convenient_service-0.18.0 lib/convenient_service/rspec/matchers/classes/results/base/entities/printers.rb
convenient_service-0.17.0 lib/convenient_service/rspec/matchers/classes/results/base/entities/printers.rb
convenient_service-0.16.0 lib/convenient_service/rspec/matchers/classes/results/base/entities/printers.rb
convenient_service-0.15.0 lib/convenient_service/rspec/matchers/classes/results/base/entities/printers.rb