Sha256: 3745e76ec7f4e4939f206ab9fe86506c12be810b48342094e9c8115827ed16d3

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

RSpec.describe Mutant::Matcher::Scope, '#call' do
  let(:scope)     { TestApp }
  let(:object)    { described_class.new(scope)       }
  let(:env)       { instance_double(Mutant::Env)     }
  let(:matcher_a) { instance_double(Mutant::Matcher) }
  let(:matcher_b) { instance_double(Mutant::Matcher) }
  let(:matcher_c) { instance_double(Mutant::Matcher) }
  let(:subject_a) { instance_double(Mutant::Subject) }
  let(:subject_b) { instance_double(Mutant::Subject) }
  let(:subject_c) { instance_double(Mutant::Subject) }

  subject { object.call(env) }

  before do
    expect(Mutant::Matcher::Methods::Singleton).to receive(:new)
      .with(scope)
      .and_return(matcher_a)

    expect(Mutant::Matcher::Methods::Instance).to receive(:new)
      .with(scope)
      .and_return(matcher_b)

    expect(Mutant::Matcher::Methods::Metaclass).to receive(:new)
      .with(scope)
      .and_return(matcher_c)

    expect(matcher_a).to receive(:call)
      .with(env)
      .and_return([subject_a])

    expect(matcher_b).to receive(:call)
      .with(env)
      .and_return([subject_b])

    expect(matcher_c).to receive(:call)
      .with(env)
      .and_return([subject_c])
  end

  it 'concatenates subjects from matched singleton and instance methods' do
    should eql([subject_a, subject_b, subject_c])
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mutant-0.9.11 spec/unit/mutant/matcher/scope_spec.rb
mutant-0.9.10 spec/unit/mutant/matcher/scope_spec.rb
mutant-0.9.9 spec/unit/mutant/matcher/scope_spec.rb