Module: RestAssured::Config

Included in:
Application
Defined in:
lib/rest-assured/config.rb

Defined Under Namespace

Classes: ConfigHash

Class Method Summary collapse

Class Method Details

.build(opts = {}) ⇒ Object

this is meant to be called prior to include



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/rest-assured/config.rb', line 31

def self.build(opts = {})
  @user_conf = opts
  AppConfig.merge!(@user_conf)

  AppConfig.logfile ||= if AppConfig.environment == 'production'
                          './rest-assured.log'
                        else
                          File.expand_path("../../../#{AppConfig.environment}.log", __FILE__)
                        end
  build_db_config
  build_ssl_config
end

.included(klass) ⇒ Object



44
45
46
47
48
49
50
51
52
53
# File 'lib/rest-assured/config.rb', line 44

def self.included(klass)
  init_logger
  setup_db

  klass.set :port, AppConfig.port
  klass.set :environment, AppConfig.environment

  klass.enable :logging
  klass.use Rack::CommonLogger, AppConfig.logger
end

.to_cmdargsObject



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/rest-assured/config.rb', line 55

def self.to_cmdargs
  @user_conf.inject([]) do |acc, (k,v)|
    if v == true
      acc << "--#{k}"
    elsif v.is_a?(String) || v.is_a?(Integer)
      acc << "--#{k}" << v.to_s
    else
      acc
    end
  end
end