Add specs for Subject::Method#expression

This commit is contained in:
Markus Schirp 2014-08-11 14:56:39 +00:00
parent b9890801c1
commit 2f8fb313ad
2 changed files with 38 additions and 14 deletions

View file

@ -1,31 +1,43 @@
RSpec.describe Mutant::Subject::Method::Instance do
let(:object) { described_class.new(config, context, node) }
let(:context) { double }
let(:context) { Mutant::Context::Scope.new(scope, double('Source Path')) }
let(:config) { Mutant::Config::DEFAULT }
let(:node) do
s(:def, :foo, s(:args))
end
let(:scope) do
Class.new do
attr_reader :bar
def initialize
@bar = :boo
end
def foo
end
def self.name
'Test'
end
end
end
describe '#expression' do
subject { object.expression }
it { should eql(Mutant::Expression.parse('Test#foo')) }
it_should_behave_like 'an idempotent method'
end
describe '#prepare' do
let(:context) do
Mutant::Context::Scope.new(scope, double('Source Path'))
end
let(:scope) do
Class.new do
attr_reader :bar
def initialize
@bar = :boo
end
def foo
end
end
end
subject { object.prepare }
context 'on non initialize methods' do

View file

@ -12,9 +12,21 @@ RSpec.describe Mutant::Subject::Method::Singleton do
Class.new do
def self.foo
end
def self.name
'Test'
end
end
end
describe '#expression' do
subject { object.expression }
it { should eql(Mutant::Expression.parse('Test.foo')) }
it_should_behave_like 'an idempotent method'
end
describe '#prepare' do
subject { object.prepare }