Sha256: 077440c0fa46bbb9cb7d456f5949f84fe07c2da29e1be29fb30f5ed307dad1f4

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 Bytes

Contents

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.1 lib/sinclair/matchers.rb