Module: SenorArmando::Spec::HeHelpMeTest

Includes:
Goliath::TestHelper
Defined in:
lib/senor_armando/spec/he_help_me_test.rb

Constant Summary collapse

DEFAULT_ERRBACK =
Proc.new{|c| fail "HTTP Request failed #{c.response}" }

Instance Method Summary collapse

Instance Method Details

#config_fileObject



8
9
10
# File 'lib/senor_armando/spec/he_help_me_test.rb', line 8

def config_file
  Goliath.root_path('config', 'app.rb')
end

#get_api_request(query = {}, params = {}, errback = DEFAULT_ERRBACK, &block) ⇒ Object



12
13
14
15
# File 'lib/senor_armando/spec/he_help_me_test.rb', line 12

def get_api_request query={}, params={}, errback=DEFAULT_ERRBACK, &block
  params[:query] = query
  get_request(params, errback, &block)
end

#should_have_ok_response(c) ⇒ Object



21
22
23
# File 'lib/senor_armando/spec/he_help_me_test.rb', line 21

def should_have_ok_response(c)
  [c.response, c.response_header.status].should == ["Hello from Responder\n", 200]
end

#should_have_response(c, r) ⇒ Object



17
18
19
# File 'lib/senor_armando/spec/he_help_me_test.rb', line 17

def should_have_response(c,r)
  [c.response, c.response_header.status].should == r
end

#with_echo_target(api, options) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/senor_armando/spec/he_help_me_test.rb', line 25

def with_echo_target api, options
  with_api(api, options) do |api|
    s = server(SenorArmando::Endpoint::Echo, 9009)
    Settings[:forwarder] = 'http://localhost:9009'
    yield
  end
end