Sha256: 2e7657ed8d0b052f349d3476e3240f0c8ee5746cc19169a1760682e501a88a45

Contents?: true

Size: 1 KB

Versions: 17

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Sinclair::Matchers::ChangeInstanceMethod do
  describe 'yard' do
    describe '#on' do
      context 'when checking against Class' do
        let(:klass)   { Class.new(MyModel) }
        let(:builder) { Sinclair.new(klass) }

        before do
          builder.add_method(:the_method) { 10 }
          builder.build
          builder.add_method(:the_method) { 20 }
        end

        it do
          expect { builder.build }.to change_method(:the_method).on(klass)
        end
      end

      context 'when checking against an intance' do
        let(:klass)    { Class.new(MyModel) }
        let(:instance) { klass.new }
        let(:builder)  { Sinclair.new(klass) }

        before do
          builder.add_method(:the_method) { 10 }
          builder.build
          builder.add_method(:the_method) { 20 }
        end

        it do
          expect { builder.build }.to change_method(:the_method).on(instance)
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
sinclair-2.1.1 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-2.1.0 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-2.0.1 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-2.0.0 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.16.3 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.16.2 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.16.1 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.16.0 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.15.0 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.14.2 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.14.1 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.14.0 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.13.0 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.12.1 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.12.0 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.11.0 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb
sinclair-1.10.0 spec/integration/yard/sinclair/matchers/change_instance_method_spec.rb