Class: SpecSelector

Overview

The SpecSelector instance receives example execution data from the reporter and arranges it into a formatted, navigable map.

Constant Summary

Constants included from SpecSelectorUtil::Initialize

SpecSelectorUtil::Initialize::STREAMS

Constants included from SpecSelectorUtil::Format

SpecSelectorUtil::Format::ESCAPE_CODES

Constants included from SpecSelectorUtil::UI

SpecSelectorUtil::UI::DIRECTION_KEYS, SpecSelectorUtil::UI::OPTION_KEYS, SpecSelectorUtil::UI::TREE_NAVIGATION_KEYS

Instance Method Summary collapse

Methods included from SpecSelectorUtil::State

#add_or_remove_from_filter, #appended_arguments, #check_inclusion_status, #clear_filter, #delete_filter_data, #display_rerun, #filter_include, #filter_remove, #persist_descriptions, #persist_filter, #persist_locations, #prepare_description_arguments, #prepare_location_arguments, #prepare_rerun, #remove_old_descriptions, #remove_old_locations, #rerun, #rerun_all, #reset_arguments, #run_only_fails, #top_fail!

Methods included from SpecSelectorUtil::Instructions

#all_passed_message, #back_instructions, #basic_instructions, #display_filter_mode, #empty_filter_notice, #example_summary_instructions, #exit_instruction_page, #filter_pass_instructions, #i_for_instructions, #q_to_exit, #toggle_instructions, #top_fail_text, #up_down_select_instructions, #view_instructions_page, #view_other_examples

Methods included from SpecSelectorUtil::Initialize

#descriptions, #init_counters, #init_example_store, #init_filter, #init_map, #init_pass_inclusion, #init_selector, #init_summaries, #initialize_all, #locations, #stderr_log, #stdout_log

Methods included from SpecSelectorUtil::DataMap

#map_example, #map_group, #parent_data, #top_level_push

Methods included from SpecSelectorUtil::Helpers

#all_passed?, #all_passing?, #any_failed?, #any_pending?, #current_path, #description_mode?, #empty_line, #example?, #filter_view?, #location_mode?, #none_passing?, #one_liner?, #status, #top_level?

Methods included from SpecSelectorUtil::DataPresentation

#display_example, #display_list, #display_stderr_log, #display_stdout_log, #errors_before_formatter_initialization, #errors_summary, #example_list, #examples_summary, #exclude_passing!, #include_passing!, #messages_only, #print_errors, #print_messages, #print_summary, #refresh_display, #status_count, #status_summary, #test_data_summary, #toggle_passing, #view_inclusion_filter

Methods included from SpecSelectorUtil::Format

#fail_count, #fetch_examples, #format_example, #format_list_item, #highlight, #lineage, #pass_count, #pending_count, #print_nonpassing_example, #print_passing_example

Methods included from SpecSelectorUtil::Terminal

#clear_frame, #close_alt_buffer, #hide_cursor, #open_alt_buffer, #position_cursor, #reset_cursor, #reveal_cursor, #term_height, #term_width

Methods included from SpecSelectorUtil::UI

#back, #bind_input, #direction_keys, #exit_instruction_page_only, #exit_only, #navigate, #option_keys, #parent_list, #quit, #select_item, #selector, #set_selected, #top_fail, #top_level_list, #tree_nav_keys, #user_input

Constructor Details

#initialize(output) ⇒ SpecSelector

Returns a new instance of SpecSelector.



37
38
39
40
41
42
43
# File 'lib/spec_selector.rb', line 37

def initialize(output)
  $stderr = stderr_log
  $stdout = stdout_log
  @output = output
  hide_cursor
  initialize_all
end

Instance Method Details

#dump_summary(notification) ⇒ Object



85
86
87
88
89
90
91
92
93
# File 'lib/spec_selector.rb', line 85

def dump_summary(notification)
  $stdout = STDOUT
  @example_count = notification.example_count
  @outside_errors_count = notification.errors_outside_of_examples_count
  errors_before_formatter_initialization
  print_errors(notification) if @outside_errors_count.positive?
  messages_only if @map.empty?
  examples_summary(notification)
end

#example_failed(notification) ⇒ Object



75
76
77
78
79
80
81
82
83
# File 'lib/spec_selector.rb', line 75

def example_failed(notification)
  clear_frame
  @failure_summaries[notification.example] = notification
  @failed << notification.example
  map_example(notification.example)
  check_inclusion_status(notification.example)
  @fail_count += 1
  status_count
end

#example_group_started(notification) ⇒ Object



49
50
51
52
53
54
# File 'lib/spec_selector.rb', line 49

def example_group_started(notification)
  group = notification.group
  map_group(group)
  @groups[group.[:block]] = group
  check_inclusion_status(group)
end

#example_passed(notification) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/spec_selector.rb', line 56

def example_passed(notification)
  clear_frame
  @passed << notification.example
  map_example(notification.example)
  check_inclusion_status(notification.example)
  @pass_count += 1
  status_count
end

#example_pending(notification) ⇒ Object



65
66
67
68
69
70
71
72
73
# File 'lib/spec_selector.rb', line 65

def example_pending(notification)
  clear_frame
  @pending_summaries[notification.example] = notification
  @pending << notification.example
  map_example(notification.example)
  check_inclusion_status(notification.example)
  @pending_count += 1
  status_count
end

#message(notification) ⇒ Object



45
46
47
# File 'lib/spec_selector.rb', line 45

def message(notification)
  @messages << notification.message
end