Class: Heroku::Samorau::ProvisionResponseCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/heroku/samorau.rb

Instance Attribute Summary

Attributes inherited from Check

#data, #screen

Instance Method Summary collapse

Methods inherited from Check

#call, #check, #error, #initialize, #run, #test, #to_proc

Constructor Details

This class inherits a constructor from Heroku::Samorau::Check

Instance Method Details

#call!Object



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/heroku/samorau.rb', line 239

def call!
  response = data[:provision_response]
  test "response"
  check "contains an id" do
    response.has_key?("id")
  end

  if response.has_key?("config")
    test "config data"
    check "is a hash" do
      response["config"].is_a?(Hash)
    end

    check "all config keys were previously defined in the manifest" do
      response["config"].keys.each do |key|
        error "#{key} is not in the manifest" unless data["api"]["config_vars"].include?(key)
      end
      true
    end

    check "all config values are strings" do
      response["config"].each do |k, v|
        if v.is_a?(String)
          true
        else
          error "#{v.inspect} is not a string"
        end
      end
    end
  end
end