Module: Common::Helper
Instance Method Summary
collapse
Methods included from Faker
#random_email, #random_first_name, #random_last_name, #random_name
Instance Method Details
#app ⇒ Object
21
22
23
|
# File 'lib/generators/command/templates/helper.rb', line 21
def app
Rack::Builder.parse_file('config.ru').first
end
|
#body_ids ⇒ Object
33
34
35
|
# File 'lib/generators/command/templates/helper.rb', line 33
def body_ids
parsed_body.map { |obj| obj['id'] }
end
|
#http_status ⇒ Object
25
26
27
|
# File 'lib/generators/command/templates/helper.rb', line 25
def http_status
last_response.status
end
|
#json_body ⇒ Object
9
10
11
|
# File 'lib/generators/command/templates/helper.rb', line 9
def json_body
last_response.body
end
|
29
30
31
|
# 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) ⇒ Object
17
18
19
|
# File 'lib/generators/command/templates/helper.rb', line 17
def json_encode(json_hash)
ActiveSupport::JSON.encode(json_hash)
end
|
#mail_deliveries ⇒ Object
37
38
39
|
# File 'lib/generators/command/templates/helper.rb', line 37
def mail_deliveries
ActionMailer::Base.deliveries
end
|
#parsed_body ⇒ Object
13
14
15
|
# File 'lib/generators/command/templates/helper.rb', line 13
def parsed_body
JSON.parse(json_body, symbolize_names: true)
end
|