Sha256: c203004c06ba404285bd4512531ca4c34c8efb832240a0c842623d02d9dd2787

Contents?: true

Size: 1.1 KB

Versions: 19

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Mutant::Mutator, '#emit' do
  subject { object.send(:emit, generated) }

  class Block
    def arguments; @arguments; end

    def called?
      defined?(@arguments)
    end

    def call(*arguments)
      @arguments = arguments
    end
  end

  let(:object) { class_under_test.new(input, parent, block) }
  let(:block)  { Block.new                                  }
  let(:input)  { :input                                     }
  let(:parent) { :parent                                    }

  let(:class_under_test) do
    Class.new(described_class) do
      def dispatch
        #noop
      end
    end
  end

  context 'with generated that is not equal to input' do
    let(:generated) { :generated }

    it 'should call block' do
      subject
      block.should be_called
    end

    it 'should call block with generated' do
      subject
      block.arguments.should eql([generated])
    end
  end

  context 'with generated object that is equal to input' do
    let(:generated) { input }

    it 'should not call block' do
      subject
      block.should_not be_called
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
mutant-0.3.0.beta21 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta20 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta19 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta18 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta17 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta16 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta15 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta14 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta13 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta12 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta11 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta10 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta9 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta8 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta7 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta6 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta5 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta4 spec/unit/mutant/mutator/emit_spec.rb
mutant-0.3.0.beta3 spec/unit/mutant/mutator/emit_spec.rb