Sha256: dc1e6acca466d04797a4c04c0ee7ad8929ebb65bb30f42efea34d487996b5531
Contents?: true
Size: 1.62 KB
Versions: 17
Compression:
Stored size: 1.62 KB
Contents
# frozen_string_literal: true RSpec.describe Mutant::Expression::Methods do let(:object) { described_class.new(attributes) } describe '#match_length' do let(:attributes) { { scope_name: 'TestApp::Literal', scope_symbol: '#' } } subject { object.match_length(other) } context 'when other is an equivalent expression' do let(:other) { parse_expression(object.syntax) } it { should be(object.syntax.length) } end context 'when other is matched' do let(:other) { parse_expression('TestApp::Literal#foo') } it { should be(object.syntax.length) } end context 'when other is an not matched expression' do let(:other) { parse_expression('Foo*') } it { should be(0) } end end describe '#syntax' do subject { object.syntax } context 'with an instance method' do let(:attributes) { { scope_name: 'TestApp::Literal', scope_symbol: '#' } } it { should eql('TestApp::Literal#') } end context 'with a singleton method' do let(:attributes) { { scope_name: 'TestApp::Literal', scope_symbol: '.' } } it { should eql('TestApp::Literal.') } end end describe '#matcher' do subject { object.matcher } context 'with an instance method' do let(:attributes) { { scope_name: 'TestApp::Literal', scope_symbol: '#' } } it { should eql(Mutant::Matcher::Methods::Instance.new(TestApp::Literal)) } end context 'with a singleton method' do let(:attributes) { { scope_name: 'TestApp::Literal', scope_symbol: '.' } } it { should eql(Mutant::Matcher::Methods::Singleton.new(TestApp::Literal)) } end end end
Version data entries
17 entries across 17 versions & 1 rubygems