features/step_definitions/json_steps.rb in visage-app-0.9.4 vs features/step_definitions/json_steps.rb in visage-app-0.9.5
- old
+ new
@@ -3,10 +3,12 @@
lambda {
@response = yajl.parse(response_body)
}.should_not raise_error
case
+ when @response.class == Array
+ next
when @response.keys.first == "hosts"
@response["hosts"].should respond_to(:size)
when @response[@response.keys.first].respond_to?(:size)
host = @response.keys.first
plugins = @response[host]
@@ -119,5 +121,15 @@
Then /^the JSON should have a list of plugins$/ do
host = @response.keys.first
plugins = @response[host]
plugins.size.should > 0
end
+
+Then /^the JSON should have a list of types$/ do
+ @response.size.should > 0
+ @response.each do |type|
+ %w(dataset datasource type min max).each do |attr|
+ type[attr].should_not be_nil
+ end
+ end
+end
+