Sha256: 10da55e257497f6f90da8a4255d765ca27aa18d410ea28977ff6870ffdae615c

Contents?: true

Size: 904 Bytes

Versions: 1

Compression:

Stored size: 904 Bytes

Contents

# frozen_string_literal: true

class Sinclair
  # Matchers module will have the DSL to be included in RSpec in order to have
  # access to the matchers
  #
  # @example
  #  RSpec.configure do |config|
  #    config.include Sinclair::Matchers
  #  end
  #
  #  class MyModel
  #  end
  #
  #  RSpec.describe 'my test' do
  #    let(:klass)   { Class.new(MyModel) }
  #    let(:builder) { Sinclair.new(klass) }
  #
  #    before do
  #      builder.add_method(:class_name, 'self.class.name')
  #    end
  #
  #    it do
  #      expect { builder.build }.to add_method(:class_name).to(klass)
  #    end
  #  end
  module Matchers
    autoload :AddMethod,   'sinclair/matchers/add_method'
    autoload :AddMethodTo, 'sinclair/matchers/add_method_to'

    # DSL to AddMethod
    # @return [AddMethod] RSpec Matcher
    def add_method(method)
      Sinclair::Matchers::AddMethod.new(method)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sinclair-1.1.2 lib/sinclair/matchers.rb