free_mutant/spec/unit/mutant/expression/method_spec.rb
Markus Schirp a19f3b1691 Nuke UTF-8 encoding headers
* I do not use 1.9.3
* Also keeping them in each file increases mental overhead (true it *can* be autoamted)
* None of the files encodes NON ASCII chars.
* I do not expect it makes any difference, since nobody programmatically
  will consume strings generated by mutant under the assumption they are UTF-8 encoded.
* 1.9.3 Users have to deal with the encoding fuckup under ruby anyways.
2014-06-09 15:37:48 +00:00

48 lines
1.3 KiB
Ruby

require 'spec_helper'
describe Mutant::Expression::Method do
let(:object) { described_class.parse(input) }
let(:cache) { Mutant::Cache.new }
let(:instance_method) { 'TestApp::Literal#string' }
let(:singleton_method) { 'TestApp::Literal.string' }
describe '#match_length' do
let(:input) { instance_method }
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
describe '#matcher' do
subject { object.matcher(cache) }
context 'with an instance method' do
let(:input) { instance_method }
it 'returns correct matcher' do
should eql(Mutant::Matcher::Method::Instance.new(
cache,
TestApp::Literal, TestApp::Literal.instance_method(:string)
))
end
end
context 'with a singleton method' do
let(:input) { singleton_method }
it { should eql(Mutant::Matcher::Method::Singleton.new(cache, TestApp::Literal, TestApp::Literal.method(:string))) }
end
end
end