Class: Greenlight::Runner

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/greenlight.rb

Constant Summary collapse

ATLAS_ENV_PREFIX =
'greenlight'
ATLAS_ENV_SEPARATOR =
'_'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRunner

Returns a new instance of Runner.



89
90
91
92
# File 'lib/greenlight.rb', line 89

def initialize
  self.params = {}
  self.data = {}
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



14
15
16
# File 'lib/greenlight.rb', line 14

def data
  @data
end

#paramsObject

Returns the value of attribute params.



14
15
16
# File 'lib/greenlight.rb', line 14

def params
  @params
end

Instance Method Details

#add_header(header, value) ⇒ Object



120
121
122
# File 'lib/greenlight.rb', line 120

def add_header(header, value)
  Injector.instance.add_header(header, value)
end

#add_headers(headers) ⇒ Object



128
129
130
131
132
# File 'lib/greenlight.rb', line 128

def add_headers(headers)
  headers.each do |key, val|
    Injector.instance.add_header(key, val)
  end
end

#load_data(uri, overwrite = false) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/greenlight.rb', line 94

def load_data(uri, overwrite = false)
  info "loading data from #{uri}"
  if uri.start_with?('http://', 'https://')
    new_data = load_data_url(uri)
  else
    new_data = load_data_file(uri)
  end

  if overwrite
    self.data = new_data
  else
    self.data.merge!(new_data)
  end

  load_env
  new_data
end

#rm_header(header) ⇒ Object



124
125
126
# File 'lib/greenlight.rb', line 124

def rm_header(header)
  Injector.instance.rm_header(header)
end

#scenario(name, &block) ⇒ Object



116
117
118
# File 'lib/greenlight.rb', line 116

def scenario(name, &block)
  Scenario.new(name, &block).run
end

#test(name, &block) ⇒ Object



112
113
114
# File 'lib/greenlight.rb', line 112

def test(name, &block)
  Test.new(name, &block).run
end