Module: Opsmgr::Teapot::SpecHelper

Defined in:
lib/opsmgr/teapot/spec_helper.rb

Instance Method Summary collapse

Instance Method Details

#post(path, params = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/opsmgr/teapot/spec_helper.rb', line 10

def post(path, params = {})
  req = Net::HTTP::Post.new(path)
  req.set_form_data(params)
  response = teapot_client.request(req)

  fail "Teapot gave HTTP response #{response.code} POST of #{path} with #{params.inspect}" if response.is_a?(Net::HTTPInternalServerError)

  response
end

#set_teapot_version(version) ⇒ Object



6
7
8
# File 'lib/opsmgr/teapot/spec_helper.rb', line 6

def set_teapot_version(version)
  post('/teapot/version', version: version)
end

#teapot_clientObject



20
21
22
# File 'lib/opsmgr/teapot/spec_helper.rb', line 20

def teapot_client
  Net::HTTP.new('localhost', App.port)
end