Sha256: 16af95e1d36e3645eafdcd01c938e41cbc967609986fb3c7341e1945c4fedf7d

Contents?: true

Size: 721 Bytes

Versions: 4

Compression:

Stored size: 721 Bytes

Contents

module RSpec
  module Hanami
    module Matchers
      extend ::RSpec::Matchers::DSL

      # @api public
      # Passes if `response` has a not 4xx and 5xx error code.
      #
      # @example Accepts numeric and symbol statuses
      #   response = action.call(params)
      #   expect(response).to be_success
      #
      matcher :be_success do
        attr_reader :actual, :object

        description { "have response success" }
        match do |object|
          @object = object
          @actual = object.first
          !RSpec::Hanami::MatchStatus.new.call(actual, :error)
        end

        failure_message { |actual| "expect #{object} to have status success" }
        diffable
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-hanami-0.4.0 lib/rspec/hanami/matchers/be_status.rb
rspec-hanami-0.3.1 lib/rspec/hanami/matchers/be_status.rb
rspec-hanami-0.3.0 lib/rspec/hanami/matchers/be_status.rb
rspec-hanami-0.2.0 lib/rspec/hanami/matchers/be_status.rb