Sha256: 2e66377d14ba2b2237314fbd56e6c719dcc37d48c1387fe90aecf1fc23a72118

Contents?: true

Size: 707 Bytes

Versions: 1

Compression:

Stored size: 707 Bytes

Contents

module ApplicationConfig
  class Base
    @@orig = nil
  
    def self.reset_config_after_test
      if @@orig
        @@application_config = @@orig.dup
      end
    end
  
    def self.add(config_text_yml)
      unless @@orig
        @@orig = @@application_config.dup
      end
      @@application_config.add(config_text_yml)
    end
  
    def dup
      new_config = ApplicationConfig::Base.new
      new_config.config = @config.dup
      new_config
    end
  
    protected
  
    def config=(config)
      @config = config
    end
  end
end

class ActiveSupport::TestCase
  teardown :reset_application_config

  def reset_application_config
    ApplicationConfig::Base.reset_config_after_test
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
application_config-0.0.2 lib/application_config_test_ext.rb