Sha256: b34f48d41fdc1323ea47637ea7245735eb80b10c5c5d16e5fadaea17b7dc5af3
Contents?: true
Size: 1.13 KB
Versions: 10
Compression:
Stored size: 1.13 KB
Contents
RSpec.describe Mutant::Context::Scope do describe '.wrap' do subject { described_class.wrap(scope, node) } let(:node) { s(:str, 'test') } context 'with Module as scope' do let(:scope) { Mutant } let(:expected) do s(:module, s(:const, nil, :Mutant), s(:str, 'test') ) end it { should eql(expected) } end context 'with Class as scope' do let(:scope) { Mutant::Context } let(:expected) do s(:class, s(:const, nil, :Context), nil, s(:str, 'test') ) end it { should eql(expected) } end context 'with Class as scope' do let(:scope) { Mutant::Context } let(:expected) do s(:class, s(:const, nil, :Context), nil, s(:str, 'test') ) end it { should eql(expected) } end context 'with anything else as scope' do let(:scope) { double(name: 'Foo') } it 'raises exception' do expect { subject }.to raise_error(RuntimeError, "Cannot wrap scope: #{scope.inspect}") end end end end
Version data entries
10 entries across 10 versions & 1 rubygems