Sha256: ff7b9ac6938bc8ea159fe9c3fae364e751168dd65a308bb1d1834517281460e0
Contents?: true
Size: 966 Bytes
Versions: 8
Compression:
Stored size: 966 Bytes
Contents
# frozen_string_literal: true RSpec.describe Mutant::Expression do let(:parser) { Mutant::Config::DEFAULT.expression_parser } describe '#prefix?' do let(:object) { parser.call('Foo*') } subject { object.prefix?(other) } context 'when object is a prefix of other' do let(:other) { parser.call('Foo::Bar') } it { should be(true) } end context 'when other is not a prefix of other' do let(:other) { parser.call('Bar') } it { should be(false) } end end describe '.try_parse' do let(:object) do Class.new(described_class) do include Anima.new(:foo) const_set(:REGEXP, /(?<foo>foo)/) end end subject { object.try_parse(input) } context 'on successful parse' do let(:input) { 'foo' } it { should eql(object.new(foo: 'foo')) } end context 'on unsuccessful parse' do let(:input) { 'bar' } it { should be(nil) } end end end
Version data entries
8 entries across 8 versions & 1 rubygems