blob: 3f3ef28459ae51f2953a4f37ec20a75dc1e6fe6e (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
Then /^I should get a '(.+)' exception$/ do |exception|
self.exception.to_s.should == exception
end
Then /^the response code should be '(.+)'$/ do |response_code|
response.status.should == response_code.to_i
end
Then /^the inflated responses key '(.+)' should match '(.+)'$/ do |key, regex|
inflated_response[key].should =~ /#{regex}/
end
Then /^the inflated responses key '(.+)' should not exist$/ do |key|
inflated_response.has_key?(key).should == false
end
Then /^the inflated responses key '(.+)' should exist$/ do |key|
inflated_response.has_key?(key).should == true
end
Then /^the inflated response should be an empty array$/ do
inflated_response.should == []
end
Then /^the inflated response should include '(.+)'$/ do |entry|
inflated_response.detect { |n| n =~ /#{entry}/ }.should be(true)
end
Then /^the inflated response should be '(.+)' items long$/ do |length|
inflated_response.length.should == length.to_i
end
Then /^the '(.+)' header should match '(.+)'$/ do |header, regex|
response.headers[header].should =~ /#{regex}/
end
Then /^the inflated responses key '(.+)' should include '(.+)'$/ do |key, regex|
inflated_response[key].detect { |n| n =~ /#{regex}/ }.should be(true)
end
Then /^the inflated response should match the '(.+)'$/ do |stash_name|
stash[stash_name].each do |k,v|
inflated_response[k.to_s].should == v
end
end
Then /^the inflated response should be the '(.+)'$/ do |stash_key|
stash[stash_key].should == inflated_response
end
Then /^the inflated response should be a kind of '(.+)'$/ do |thing|
inflated_response.should be_a_kind_of(thing)
end
Then /^the inflated response should respond to '(.+)' with '(.+)'$/ do |method, to_match|
to_match = JSON.parse(to_match) if to_match =~ /^\[|\{/
inflated_response.send(method.to_sym).should == to_match
end
Then /^the inflated response should respond to '(.+)' and match '(.+)'$/ do |method, to_match|
inflated_response.send(method.to_sym).should == to_match
end
Then /^the fields in the inflated response should match the '(.+)'$/ do |stash_name|
inflated_response.each do |k,v|
unless k =~ /^_/ || k == 'couchrest-type'
stash[stash_name][k.to_sym].should == v
end
end
end
|