Sha256: 8d3137544568a2828366cd50dc6d3c97f5726514e84d4a3f725e7e9b2e1cbfd2

Contents?: true

Size: 725 Bytes

Versions: 13

Compression:

Stored size: 725 Bytes

Contents

module ConfigHelper
  extend ActiveSupport::Concern

  def with_config(preference_name, temporary_value)
    original_config_value = ActiveEnum.config.send(preference_name)
    
    ActiveEnum.config.send(:"#{preference_name}=", temporary_value)
    yield
  ensure
    ActiveEnum.config.send(:"#{preference_name}=", original_config_value)
  end

  module ClassMethods
    def with_config(preference_name, temporary_value)
      original_config_value = ActiveEnum.config.send(preference_name)

      before(:all) do
        ActiveEnum.config.send(:"#{preference_name}=", temporary_value)
      end

      after(:all) do
        ActiveEnum.config.send(:"#{preference_name}=", original_config_value)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
active_enum-1.2.1 spec/support/config_helper.rb
active_enum-1.2.0 spec/support/config_helper.rb
active_enum-1.1.0 spec/support/config_helper.rb
active_enum-1.0.0 spec/support/config_helper.rb
active_enum-1.0.0.rc8 spec/support/config_helper.rb
active_enum-1.0.0.rc7 spec/support/config_helper.rb
active_enum-1.0.0.rc6 spec/support/config_helper.rb
active_enum-1.0.0.rc5 spec/support/config_helper.rb
active_enum-1.0.0.rc4 spec/support/config_helper.rb
active_enum-1.0.0.rc3 spec/support/config_helper.rb
active_enum-1.0.0.rc2 spec/support/config_helper.rb
active_enum-1.0.0.rc1 spec/support/config_helper.rb
active_enum-1.0.0.pre spec/support/config_helper.rb