Sha256: bb3be558e9db20c31091d85a8dc32d01455aab2fd188031d70f899a1589f0e6a
Contents?: true
Size: 812 Bytes
Versions: 2
Compression:
Stored size: 812 Bytes
Contents
require 'active_support/dependencies' module AktionTest module ClassBuilder def self.included(example_group) example_group.class_eval do after do teardown_defined_constants end end end def define_class(class_name, base = Object, &block) class_name = class_name.to_s.camelize Class.new(base).tap do |constant_class| Object.const_set(class_name, constant_class) constant_class.unloadable constant_class.class_eval(&block) if block_given? constant_class.reset_column_information if constant_class.respond_to? :reset_column_information end end def teardown_defined_constants ActiveSupport::Dependencies.clear end end end RSpec.configure {|config| config.include AktionTest::ClassBuilder}
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aktion_test-0.1.2 | lib/aktion_test/class_builder.rb |
aktion_test-0.1.1 | lib/aktion_test/class_builder.rb |