Sha256: 7b2f44f37db27ccc41fd14316fa707947217c5bd798d6194515f39275be991b0
Contents?: true
Size: 779 Bytes
Versions: 9
Compression:
Stored size: 779 Bytes
Contents
# frozen_string_literal: true require 'spec_helper' describe Sinclair::Matchers::AddMethod do subject(:matcher) { described_class.new(method) } let(:method) { :the_method } let(:klass) { Class.new } let(:instance) { klass.new } describe '#to' do it do expect(matcher.to(klass.new)).to be_a(Sinclair::Matchers::AddMethodTo) end it 'returns an add_method_to' do expect(matcher.to(instance)).to eq(Sinclair::Matchers::AddMethodTo.new(instance, method)) end end describe '#matches?' do it do expect { matcher.matches?(proc {}) } .to raise_error( SyntaxError, 'You should specify which instance the method is being added to' \ "add_method(:#{method}).to(instance)" ) end end end
Version data entries
9 entries across 9 versions & 1 rubygems