Module: RSpecPower::RequestDumpHelpers

Defined in:
lib/rspec_power/request_dump.rb

Instance Method Summary collapse

Instance Method Details

#dump_state_after_example(example, what_items) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rspec_power/request_dump.rb', line 3

def dump_state_after_example(example, what_items)
  items_to_dump = Array(what_items).map(&:to_sym)

  puts "\n[rspec_power] Dump after example: #{example.full_description}"

  if items_to_dump.include?(:session)
    value = fetch_session_value
    puts "[rspec_power] session: #{safe_inspect(value)}"
  end

  if items_to_dump.include?(:cookies)
    value = fetch_cookies_value
    puts "[rspec_power] cookies: #{safe_inspect(value)}"
  end

  if items_to_dump.include?(:flash)
    value = fetch_flash_value
    puts "[rspec_power] flash: #{safe_inspect(value)}"
  end

  if items_to_dump.include?(:headers)
    value = fetch_headers_value
    puts "[rspec_power] headers: #{safe_inspect(value)}"
  end
end