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



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

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



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

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



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

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