Sha256: 2705a995a18a688d0ce8b52c05b70be3e9576447b0cd6b18a0d90ed9761cfe3d

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

class Sinclair
  # @api public
  # @author darthjee
  #
  # 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
    #
    # @example (see Sinclair::Matchers)
    # @example (see Sinclair::Matchers::AddMethod#to)
    #
    # @return [AddMethod] RSpec Matcher
    def add_method(method)
      Sinclair::Matchers::AddMethod.new(method)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sinclair-1.4.1 lib/sinclair/matchers.rb
sinclair-1.4.0 lib/sinclair/matchers.rb
sinclair-1.3.4 lib/sinclair/matchers.rb
sinclair-1.3.3 lib/sinclair/matchers.rb
sinclair-1.3.2 lib/sinclair/matchers.rb
sinclair-1.3.1 lib/sinclair/matchers.rb
sinclair-1.3.0 lib/sinclair/matchers.rb
sinclair-1.2.1 lib/sinclair/matchers.rb
sinclair-1.2.0 lib/sinclair/matchers.rb
sinclair-1.1.3 lib/sinclair/matchers.rb