Sha256: 11104e42bab3db707b8eb5b32e9438eb14356676ade80bb4b0c7b89b3a3dbd32

Contents?: true

Size: 1.98 KB

Versions: 12

Compression:

Stored size: 1.98 KB

Contents

# frozen_string_literal: true

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

    let(:mutation_subject) { subject_class.new(context: context, node: node, warnings: warnings)     }
    let(:context)          { instance_double(Mutant::Context)                                        }
    let(:node)             { instance_double(Parser::AST::Node)                                      }
    let(:integration)      { instance_double(Mutant::Integration, all_tests: all_tests)              }
    let(:test_a)           { instance_double(Mutant::Test, expression: parse_expression('SubjectA')) }
    let(:test_b)           { instance_double(Mutant::Test, expression: parse_expression('SubjectB')) }
    let(:test_c)           { instance_double(Mutant::Test, expression: parse_expression('SubjectC')) }
    let(:warnings)         { instance_double(Mutant::Warnings)                                       }

    let(:subject_class) do
      parse = method(:parse_expression)

      Class.new(Mutant::Subject) do
        define_method(:expression) do
          parse.call('SubjectA')
        end

        define_method(:match_expressions) do
          [expression] << parse.call('SubjectB')
        end
      end
    end

    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

12 entries across 12 versions & 1 rubygems

Version Path
mutant-0.9.11 spec/unit/mutant/selector/expression_spec.rb
mutant-0.9.10 spec/unit/mutant/selector/expression_spec.rb
mutant-0.9.9 spec/unit/mutant/selector/expression_spec.rb
mutant-0.9.8 spec/unit/mutant/selector/expression_spec.rb
mutant-0.9.7 spec/unit/mutant/selector/expression_spec.rb
mutant-0.9.6 spec/unit/mutant/selector/expression_spec.rb
mutant-0.9.5 spec/unit/mutant/selector/expression_spec.rb
mutant-0.9.4 spec/unit/mutant/selector/expression_spec.rb
mutant-0.9.3 spec/unit/mutant/selector/expression_spec.rb
mutant-0.9.2 spec/unit/mutant/selector/expression_spec.rb
mutant-0.9.1 spec/unit/mutant/selector/expression_spec.rb
mutant-0.9.0 spec/unit/mutant/selector/expression_spec.rb