Sha256: 0f173117eeace4db2a3b712d5e813c5eef655c01abc6aabfa80a422a5a39a696

Contents?: true

Size: 553 Bytes

Versions: 5

Compression:

Stored size: 553 Bytes

Contents

shared_context 'included_module' do
  
  let(:included_module) { described_class }
  let(:klass_name)      { 'FakeModel'     }
  
  def create_fake_model_klass name
    klass = self.class.const_set(name.to_sym, Class.new)
    mod   = included_module
    klass.class_eval{ include(mod) }
    klass
  end
  
  def remove_fake_model_klass name
    self.class.send(:remove_const, name.to_sym) if self.class.const_defined? name.to_sym
  end

  subject      { create_fake_model_klass(klass_name) }
  after(:each) { remove_fake_model_klass(klass_name) }
 
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gorillib-0.6.0 spec/support/shared_examples/included_module.rb
gorillib-0.5.2 spec/support/shared_examples/included_module.rb
gorillib-0.5.0 spec/support/shared_examples/included_module.rb
gorillib-0.4.2 spec/support/shared_examples/included_module.rb
gorillib-0.4.0pre spec/support/shared_examples/included_module.rb