Class: Heroku::Samorau::CreateResponseCheck

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



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/heroku/samorau.rb', line 212

def call!
  response = data[:create_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