Sha256: 5d325a328aa68ab945eb8835e8ffa36492430abd5f78a736118208ceb557ba5a

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

module RSpec
  module Grape
    module Entity
      module Matchers
        module HaveConditionsMetMatcher
          extend RSpec::Matchers::DSL

          matcher :have_conditions_met do |object|
            include MatcherHelpers

            match do |actual|
              entity_instance = entity.new object
              actual.conditions_met? entity_instance, options
            end

            description { "have the conditions met" }

            failure_message do |actual|
              "expect that #{actual} would have the conditions met for object #{object} with options #{options}"
            end

            chain :with_options do |options|
              @options = options
            end

            def options
              @options ||= {}
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-grape-entity-0.1.0 lib/rspec_grape_entity/matchers/have_conditions_met_matcher.rb