Sha256: fcd5e4ef1f66711e53d74edfefd3a6aa5e2a643a52dd3ad7679b1fe0ace0df01
Contents?: true
Size: 1.69 KB
Versions: 2
Compression:
Stored size: 1.69 KB
Contents
# encoding: UTF-8 require 'spec_helper' describe Mutant::Subject::Method::Instance do include Mutant::NodeHelpers let(:object) { described_class.new(context, node) } let(:context) { double } let(:node) do s(:def, :foo, s(:args)) end describe '#prepare' do let(:context) do Mutant::Context::Scope.new(scope, double('Source Path')) end let(:scope) do Class.new do def foo end end end subject { object.prepare } it 'undefines method on scope' do expect { subject }.to change { scope.instance_methods.include?(:foo) }.from(true).to(false) end it_should_behave_like 'a command method' end describe '#source' do subject { object.source } it { should eql("def foo\nend") } end end describe Mutant::Subject::Method::Instance::Memoized do include Mutant::NodeHelpers let(:object) { described_class.new(context, node) } let(:context) { double } let(:node) do s(:def, :foo, s(:args)) end describe '#prepare' do let(:context) do Mutant::Context::Scope.new(scope, double('Source Path')) end let(:scope) do Class.new do include Memoizable def foo end memoize :foo end end subject { object.prepare } it 'undefines memoizer' do expect { subject }.to change { scope.memoized?(:foo) }.from(true).to(false) end it 'undefines method on scope' do expect { subject }.to change { scope.instance_methods.include?(:foo) }.from(true).to(false) end it_should_behave_like 'a command method' end describe '#source' do subject { object.source } it { should eql("def foo\nend\nmemoize(:foo)") } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mutant-0.5.10 | spec/unit/mutant/subject/method/instance_spec.rb |
mutant-0.5.9 | spec/unit/mutant/subject/method/instance_spec.rb |