Sha256: eae40e274f1119a4fc265e7784d3a1b12194364d783d2bd6b7c7b8a4f1363c68

Contents?: true

Size: 1.87 KB

Versions: 6

Compression:

Stored size: 1.87 KB

Contents

RSpec.describe Mutant::Selector::Expression do
  describe '#call' do
    let(:object) { described_class.new(integration) }

    let(:subject_class) do
      Class.new(Mutant::Subject) do
        def expression
          Mutant::Expression.parse('SubjectA')
        end

        def match_expressions
          [expression] << Mutant::Expression.parse('SubjectB')
        end
      end
    end

    let(:mutation_subject) { subject_class.new(context, node)                                   }
    let(:context)          { double('Context')                                                  }
    let(:node)             { double('Node')                                                     }

    let(:config)           { Mutant::Config::DEFAULT.update(integration: integration)           }
    let(:integration)      { double('Integration', all_tests: all_tests)                        }

    let(:test_a)           { double('test a', expression: Mutant::Expression.parse('SubjectA')) }
    let(:test_b)           { double('test b', expression: Mutant::Expression.parse('SubjectB')) }
    let(:test_c)           { double('test c', expression: Mutant::Expression.parse('SubjectC')) }

    subject { object.call(mutation_subject) }

    context 'without available tests' do
      let(:all_tests) { [] }

      it { should eql([]) }
    end

    context 'without qualifying tests' do
      let(:all_tests) { [test_c] }

      it { should eql([]) }
    end

    context 'with qualifying tests for first match expression' do
      let(:all_tests) { [test_a] }

      it { should eql([test_a]) }
    end

    context 'with qualifying tests for second match expression' do
      let(:all_tests) { [test_b] }

      it { should eql([test_b]) }
    end

    context 'with qualifying tests for the first and second match expression' do
      let(:all_tests) { [test_a, test_b] }

      it { should eql([test_a]) }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mutant-0.8.0 spec/unit/mutant/selector/expression_spec.rb
mutant-0.7.9 spec/unit/mutant/selector/expression_spec.rb
mutant-0.7.8 spec/unit/mutant/selector/expression_spec.rb
mutant-0.7.7 spec/unit/mutant/selector/expression_spec.rb
mutant-0.7.6 spec/unit/mutant/selector/expression_spec.rb
mutant-0.7.5 spec/unit/mutant/selector/expression_spec.rb