Step Definitions & Transforms
41 42 43 |
Given(/^I am a rest client$/) do @restbaby = Client.new("#{@protocol}://#{@server}:#{@port}#{@path}") end |
And
I am a rest client
features/rest_client.feature:8
features/rest_client.feature:17
features/rest_client.feature:29
features/rest_client.feature:41
features/url_parameter.feature:8
features/print_response.feature:11
features/print_response.feature:23
features/print_response.feature:38
features/print_response.feature:53
features/header_options.feature:9
features/header_options.feature:23
features/header_options.feature:38
features/header_options.feature:48
73 74 75 76 |
Then(/^I receive the expected message$/) do expect(@response.code).to eq('200') expect(@response.body).to eq(DEFAULT_MSG) end |
Then
I receive the expected message
features/rest_client.feature:10
features/rest_client.feature:22
features/rest_client.feature:34
features/rest_client.feature:43
features/print_response.feature:13
features/print_response.feature:28
features/print_response.feature:43
features/print_response.feature:55
features/header_options.feature:13
features/header_options.feature:31
features/header_options.feature:41
features/header_options.feature:51
4 5 6 7 8 9 |
Given(/^I have a web service$/) do @protocol = 'http' @server = FigNewton.server @port = FigNewton.port @mockservice = MockRestService.new(@server, @port, @protocol) end |
Given
I have a web service
features/rest_client.feature:6
features/rest_client.feature:15
features/rest_client.feature:27
features/rest_client.feature:39
features/url_parameter.feature:6
features/print_response.feature:6
features/print_response.feature:18
features/print_response.feature:33
features/print_response.feature:48
features/header_options.feature:6
features/header_options.feature:18
features/header_options.feature:36
45 46 47 48 49 50 51 52 |
When(/^I "(GET|DELETE)" from the web service$/) do |type| case type.downcase when 'get' @response = @restbaby.get when 'delete' @response = @restbaby.delete end end |
When
I "GET" from the web service
features/rest_client.feature:9
features/print_response.feature:12
features/header_options.feature:12
features/header_options.feature:40
features/header_options.feature:50
When
I "DELETE" from the web service
features/rest_client.feature:42
features/print_response.feature:54
54 55 56 57 58 59 60 61 62 63 |
When(/^I "(PUT|POST)" to the web service with the following$/) \ do |type, | @message = .strip case type.downcase when 'put' @response = @restbaby.put(@message) when 'post' @response = @restbaby.post(@message) end end |
When
I "PUT" to the web service with the following
features/rest_client.feature:18
features/print_response.feature:24
When
I "POST" to the web service with the following
features/rest_client.feature:30
features/print_response.feature:39
features/header_options.feature:27
11 12 13 14 15 16 17 18 19 20 |
Given(/^I have "(GET|PUT|POST|DELETE)" service for "([^"]*)"$/) do |type, path| @path = path if type == 'GET' create_get(path) else @path = path @mockservice.store_msg(type, path, DEFAULT_MSG, {}, nil, nil, DEFAULT_RESPONSE) end end |
And
I have "GET" service for "/test"
features/rest_client.feature:7
And
I have "PUT" service for "/test"
features/rest_client.feature:16
And
I have "POST" service for "/test"
features/rest_client.feature:28
And
I have "DELETE" service for "/test"
features/rest_client.feature:40
And
I have "GET" service for "/test?first=1&second=2&third=3"
features/url_parameter.feature:7
22 23 24 25 26 27 28 29 30 |
Given(/^I have "(GET|PUT|POST|DELETE)" service for "([^"]*)" as follows$/) \ do |type, path, | @path = path if type == 'GET' create_get(path, ) else @mockservice.store_msg(type, path, DEFAULT_MSG, {}, nil, nil, ) end end |
And
I have "GET" service for "/test" as follows
features/print_response.feature:7
And
I have "PUT" service for "/test" as follows
features/print_response.feature:19
And
I have "POST" service for "/test" as follows
features/print_response.feature:34
And
I have "DELETE" service for "/test" as follows
features/print_response.feature:49
27 28 29 |
When(/^I have the following headers?$/) do |table| @restbaby.add_headers(table.rows_hash) end |
When
I have the following header
features/header_options.feature:10
features/header_options.feature:24
1 2 3 4 5 6 |
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 a secure web service
features/header_options.feature:46
78 79 80 81 |
Then(/^I receive a message with "([^"]*)"$/) do || expect(@response.code).to eq('200') expect(@response.body).to eq() end |
Then
I receive a message with "first=1&second=2&third=3"
features/url_parameter.feature:13
65 66 67 |
When(/^I "GET" from the web service with the parameters$/) do |table| @response = @restbaby.get({}, nil, table.rows_hash) end |
When
I "GET" from the web service with the parameters
features/url_parameter.feature:9
Given
/^I have "(GET|DELETE)" service for "([^"]*)" for \
user "([^"]*)" and password "([^"]*)"$/
Rubular
| UNUSED
14 15 16 17 18 |
Given(/^I have "(GET|DELETE)" service for "([^"]*)" for \ user "([^"]*)" and password "([^"]*)"$/) do |type, path, user, password| @path = path @mockservice.store_msg(type, path, DEFAULT_MSG, {}, user, password) end |
No steps were found to match this step definition.
Given
/^I have "(PUT|POST)" service for "([^"]*)" for \
user "([^"]*)" and password "([^"]*)"$/
Rubular
| UNUSED
20 21 22 23 24 25 |
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 |
No steps were found to match this step definition.
Given
/^I have "(GET|PUT|POST|DELETE)" service for "([^"]*)" \
with the following headers$/
Rubular
| UNUSED
8 9 10 11 12 |
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 |
No steps were found to match this step definition.
31 32 33 34 |
Given(/^I have basic auth for user "([^"]*)" \ and password "(.*?)"$/) do |user, password| @restbaby.set_auth(user, password) end |
No steps were found to match this step definition.
And
I have basic auth for user "test" and password "rest"
features/header_options.feature:39
features/header_options.feature:49
And
I have "GET" service for "/test" for user "test" and password "rest"
features/header_options.feature:37
features/header_options.feature:47
And
I have "POST" service for "/test" with the following headers
features/header_options.feature:19
And
I have "GET" service for "/test" with the following headers
features/header_options.feature:7