Module: SpecSelectorUtil::Helpers
- Included in:
- SpecSelector
- Defined in:
- lib/spec_selector/helpers.rb
Overview
The Helpers module contains helper methods shared across multiple concerns.
Instance Method Summary collapse
- #all_passed?(examples) ⇒ Boolean
- #all_passing? ⇒ Boolean
- #any_failed?(examples) ⇒ Boolean
- #any_pending?(examples) ⇒ Boolean
- #current_path ⇒ Object
- #description_mode? ⇒ Boolean
- #empty_line ⇒ Object
- #example?(item) ⇒ Boolean
- #filter_view? ⇒ Boolean
- #location_mode? ⇒ Boolean
- #none_passing? ⇒ Boolean
- #one_liner?(example) ⇒ Boolean
- #status(example) ⇒ Object
- #top_level? ⇒ Boolean
Instance Method Details
#all_passed?(examples) ⇒ Boolean
15 16 17 |
# File 'lib/spec_selector/helpers.rb', line 15 def all_passed?(examples) examples.all? { |example| example.execution_result.status == :passed } end |
#all_passing? ⇒ Boolean
7 8 9 |
# File 'lib/spec_selector/helpers.rb', line 7 def all_passing? (@pending_count + @fail_count).zero? && @pass_count.positive? end |
#any_failed?(examples) ⇒ Boolean
19 20 21 |
# File 'lib/spec_selector/helpers.rb', line 19 def any_failed?(examples) examples.any? { |example| example.execution_result.status == :failed } end |
#any_pending?(examples) ⇒ Boolean
23 24 25 |
# File 'lib/spec_selector/helpers.rb', line 23 def any_pending?(examples) examples.any? { |example| example.execution_result.status == :pending } end |
#current_path ⇒ Object
55 56 57 |
# File 'lib/spec_selector/helpers.rb', line 55 def current_path File.dirname(__FILE__) end |
#description_mode? ⇒ Boolean
35 36 37 |
# File 'lib/spec_selector/helpers.rb', line 35 def description_mode? @filter_mode == :description end |
#empty_line ⇒ Object
43 44 45 |
# File 'lib/spec_selector/helpers.rb', line 43 def empty_line @output.puts "\n" end |
#example?(item) ⇒ Boolean
27 28 29 |
# File 'lib/spec_selector/helpers.rb', line 27 def example?(item) item.is_a?(RSpec::Core::Example) end |
#filter_view? ⇒ Boolean
51 52 53 |
# File 'lib/spec_selector/helpers.rb', line 51 def filter_view? @list == @inclusion_filter end |
#location_mode? ⇒ Boolean
39 40 41 |
# File 'lib/spec_selector/helpers.rb', line 39 def location_mode? @filter_mode == :location end |
#none_passing? ⇒ Boolean
11 12 13 |
# File 'lib/spec_selector/helpers.rb', line 11 def none_passing? (@pending_count + @fail_count).positive? && @pass_count.zero? end |
#one_liner?(example) ⇒ Boolean
59 60 61 |
# File 'lib/spec_selector/helpers.rb', line 59 def one_liner?(example) example.[:description_args].empty? end |
#status(example) ⇒ Object
31 32 33 |
# File 'lib/spec_selector/helpers.rb', line 31 def status(example) example.execution_result.status end |
#top_level? ⇒ Boolean
47 48 49 |
# File 'lib/spec_selector/helpers.rb', line 47 def top_level? @list == @active_map[:top_level] end |