module Common::Helper

Public Instance Methods

app() click to toggle source
# File lib/generators/command/templates/helper.rb, line 21
def app
  Rack::Builder.parse_file('config.ru').first
end
body_ids() click to toggle source
# File lib/generators/command/templates/helper.rb, line 33
def body_ids
  parsed_body.map { |obj| obj['id'] }
end
http_status() click to toggle source
# File lib/generators/command/templates/helper.rb, line 25
def http_status
  last_response.status
end
json_body() click to toggle source
# File lib/generators/command/templates/helper.rb, line 9
def json_body
  last_response.body
end
json_datetime_format(datetime) click to toggle source
# File lib/generators/command/templates/helper.rb, line 29
def json_datetime_format(datetime)
  datetime.to_formatted_s(:iso8601) if datetime
end
json_encode(json_hash) click to toggle source
# File lib/generators/command/templates/helper.rb, line 17
def json_encode(json_hash)
  ActiveSupport::JSON.encode(json_hash)
end
mail_deliveries() click to toggle source
# File lib/generators/command/templates/helper.rb, line 37
def mail_deliveries
  ActionMailer::Base.deliveries
end
parsed_body() click to toggle source
# File lib/generators/command/templates/helper.rb, line 13
def parsed_body
  JSON.parse(json_body, symbolize_names: true)
end