Sha256: 4a3b201047f29831881571df5078d3e31922613b4e56c6d9514de4d080dd453b

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

Given(/^I have a secure web service$/) do
  @protocol = 'https'
  @server = FigNewton.server
  @port = FigNewton.port
  @mockservice = MockRestService.new(@server, @port, @protocol)
end

Given(/^I have "(GET|PUT|POST|DELETE)" service for "([^"]*)" \
with the following headers$/) do |type, path, table|
  @path = path
  @mockservice.store_msg(type, path, DEFAULT_MSG, table.rows_hash, nil, nil, DEFAULT_RESPONSE)
end

Given(/^I have "(GET|DELETE)" service for "([^"]*)" for \
user "([^"]*)" and password "([^"]*)"$/) do |type, path, user, password|
  @path = path
  message = hasParams(path) ? path.split('?')[1] : DEFAULT_MSG
  @mockservice.store_msg(type, path, message, {}, user, password)
end

def hasParams(path)
  path.include?('?')
end

Given(/^I have "(PUT|POST)" service for "([^"]*)" for \
user "([^"]*)" and password "([^"]*)"$/) do |type, path, user, password, table|
  @path = path
  @headers = table.rows_hash
  @mockservice.store_msg(type, path, DEFAULT_MSG, @headers, user, password)
end

When(/^I have the following headers?$/) do |table|
  @restbaby.add_headers(table.rows_hash)
end

Given(/^I have basic auth for user "([^"]*)" \
and password "(.*?)"$/) do |user, password|
  @restbaby.set_auth(user, password)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rest_baby-1.6.0 features/step_definitions/header_steps.rb
rest_baby-1.5.1 features/step_definitions/header_steps.rb
rest_baby-1.5 features/step_definitions/header_steps.rb