Sha256: e6bab35ee6e2bdefd0e5c8c09e59a73864407e22f82f652f8e0484dbd25903c0

Contents?: true

Size: 890 Bytes

Versions: 32

Compression:

Stored size: 890 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Sinclair::Matchers::AddClassMethod do
  subject(:matcher) { described_class.new(method) }

  let(:method)   { :the_method }
  let(:klass)    { Class.new }

  describe '#to' do
    it do
      expect(matcher.to(klass.new)).to be_a(Sinclair::Matchers::AddClassMethodTo)
    end

    it 'returns an add_class_method_to' do
      expect(matcher.to(klass)).to eq(Sinclair::Matchers::AddClassMethodTo.new(klass, method))
    end
  end

  describe '#matches?' do
    it do
      expect { matcher.matches?(proc {}) }
        .to raise_error(
          SyntaxError, 'You should specify which class the method is being added to' \
          "add_class_method(:#{method}).to(klass)"
        )
    end
  end

  describe '#supports_block_expectations?' do
    it do
      expect(matcher).to be_supports_block_expectations
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
sinclair-2.1.1 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-2.1.0 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-2.0.1 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-2.0.0 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.16.3 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.16.2 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.16.1 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.16.0 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.15.0 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.14.2 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.14.1 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.14.0 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.13.0 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.12.1 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.12.0 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.11.0 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.10.0 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.9.0 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.8.0 spec/lib/sinclair/matchers/add_class_method_spec.rb
sinclair-1.7.0 spec/lib/sinclair/matchers/add_class_method_spec.rb