Sha256: 0d73d7488843157adc1779ec2c8e2ac01d05c46db80f1d83160e4e0f78cb2655

Contents?: true

Size: 916 Bytes

Versions: 14

Compression:

Stored size: 916 Bytes

Contents

require 'spec_helper'

describe Mutant, '.singleton_subclass_instance' do
  let(:object) { described_class }

  subject { object.singleton_subclass_instance(name, superclass, &block) }

  before do
    subject
  end

  let(:name)       { 'Test'                }
  let(:block)      { proc { def foo; end } }
  let(:superclass) { Class.new             }

  let(:generated) { superclass.const_get(:Test) }

  it_should_behave_like 'a command method'

  it 'sets expected name' do
    name = generated.class.name
    name.should eql("::#{self.name}")
    name.should be_frozen
  end

  it 'stores instance of subclass' do
    generated.should be_kind_of(superclass)
  end

  it 'evaluates the context of proc inside subclass' do
    generated.should respond_to(:foo)
  end

  it 'generates nice #inspect' do
    inspect = generated.inspect
    inspect.should eql("::#{self.name}")
    inspect.should be_frozen
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
mutant-0.3.0.beta21 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta20 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta19 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta18 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta17 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta16 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta15 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta14 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta13 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta12 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta11 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta10 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta9 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb
mutant-0.3.0.beta8 spec/unit/mutant/class_methods/singleton_subclass_instance_spec.rb