Sha256: 1a491de4ddcfd5baabf14ba1f5f41abf7b95f6e9f1c2cf47964747685eeb4782
Contents?: true
Size: 1.37 KB
Versions: 12
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true RSpec.describe Mutant::Expression::Parser do subject do Mutant::Config::DEFAULT.expression_parser end def apply subject.apply(input) end describe '#apply' do context 'on a valid expression' do let(:input) { 'Foo' } it 'returns sucess' do expect(apply).to eql( Mutant::Either::Right.new( Mutant::Expression::Namespace::Exact.new(scope_name: 'Foo') ) ) end end context 'on invalid input' do let(:input) { 'foo bar' } it 'returns returns error' do expect(apply).to eql( Mutant::Either::Left.new('Expression: "foo bar" is invalid') ) end end context 'on ambiguous input' do subject do described_class.new([test_a, test_b]) end let(:test_a) do Class.new(Mutant::Expression) do include Anima.new const_set(:REGEXP, /\Atest-syntax\z/.freeze) end end let(:test_b) do Class.new(Mutant::Expression) do include Anima.new const_set(:REGEXP, /^test-syntax$/.freeze) end end let(:input) { 'test-syntax' } it 'returns error' do expect(apply).to eql( Mutant::Either::Left.new( 'Expression: "test-syntax" is ambiguous' ) ) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems