2013-09-13 19:10:03 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Mutant::Subject do
|
|
|
|
let(:class_under_test) do
|
|
|
|
Class.new(described_class) do
|
2014-06-28 18:31:29 -04:00
|
|
|
def expression
|
|
|
|
Mutant::Expression.parse('Test')
|
2013-09-13 19:10:03 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-03 17:16:12 -04:00
|
|
|
let(:object) { class_under_test.new(config, context, node) }
|
|
|
|
|
|
|
|
let(:config) { Mutant::Config::DEFAULT }
|
2013-09-13 19:10:03 -04:00
|
|
|
|
|
|
|
let(:node) do
|
2013-09-13 19:17:14 -04:00
|
|
|
double('Node', location: location)
|
2013-09-13 19:10:03 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
let(:location) do
|
2013-09-13 19:17:14 -04:00
|
|
|
double('Location', expression: expression)
|
2013-09-13 19:10:03 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
let(:expression) do
|
2013-09-13 19:17:14 -04:00
|
|
|
double('Expression', line: 'source_line')
|
2013-09-13 19:10:03 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
let(:context) do
|
|
|
|
double(
|
|
|
|
'Context',
|
2013-09-13 19:17:14 -04:00
|
|
|
source_path: 'source_path',
|
2014-03-08 13:01:17 -05:00
|
|
|
source_line: 'source_line'
|
2013-09-13 19:10:03 -04:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#identification' do
|
|
|
|
subject { object.identification }
|
|
|
|
|
2014-06-28 18:31:29 -04:00
|
|
|
it { should eql('Test:source_path:source_line') }
|
2013-09-13 19:10:03 -04:00
|
|
|
end
|
2014-07-03 17:16:12 -04:00
|
|
|
|
|
|
|
describe '#node' do
|
|
|
|
subject { object.node }
|
|
|
|
|
|
|
|
it { should be(node) }
|
|
|
|
|
|
|
|
it_should_behave_like 'an idempotent method'
|
|
|
|
end
|
2013-09-13 19:10:03 -04:00
|
|
|
end
|