blob: e2d9f0989dd1afb8d3cbd748de04c85be65fee88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
Given /^Content-Type is (.*)/ do |content_type|
@content_type = content_type
end
When /^I post (.*) to the (.*) webservice$/ do |data,component|
#puts @@config[:services]["opentox-#{component}"]
case data
when /^file:/
data = File.read(File.join(File.dirname(File.expand_path(__FILE__)),"../data",data.sub(/file:\s+/,'')))
@data = data
end
@uri = RestClient.post @@config[:services]["opentox-#{component}"], data, :content_type => @content_type
@resources << @uri unless /compound|feature/ =~ component
end
Then /^I should receive a valid URI$/ do
@response = RestClient.get @uri
#puts @response
end
Then /^the URI should contain (.+)$/ do |result|
#puts @uri
regexp = /#{Regexp.escape(URI.encode(result))}/
assert regexp =~ @uri, true
end
Then /^the URI response should be (.+)$/ do |data|
case data
when /^file:/
data = @data
end
assert data == @response, true
end
|