2014-08-10 21:04:05 +00:00
|
|
|
RSpec.describe Mutant::Expression::Namespace::Exact do
|
2014-05-31 01:02:15 +00:00
|
|
|
|
2014-08-10 14:45:45 +00:00
|
|
|
let(:object) { described_class.parse(input) }
|
|
|
|
let(:env) { Fixtures::TEST_ENV }
|
|
|
|
let(:input) { 'TestApp::Literal' }
|
2014-05-31 01:02:15 +00:00
|
|
|
|
|
|
|
describe '#matcher' do
|
2014-08-10 14:45:45 +00:00
|
|
|
subject { object.matcher(env) }
|
2014-05-31 01:02:15 +00:00
|
|
|
|
2014-08-10 14:45:45 +00:00
|
|
|
it { should eql(Mutant::Matcher::Scope.new(env, TestApp::Literal, object)) }
|
2014-05-31 01:02:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe '#match_length' do
|
|
|
|
subject { object.match_length(other) }
|
|
|
|
|
|
|
|
context 'when other is an equivalent expression' do
|
|
|
|
let(:other) { described_class.parse(object.syntax) }
|
|
|
|
|
|
|
|
it { should be(object.syntax.length) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when other is an unequivalent expression' do
|
|
|
|
let(:other) { described_class.parse('Foo*') }
|
|
|
|
|
|
|
|
it { should be(0) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|