class RSpecSearchAndDestroy::ReorderAndFilter

Attributes

source[R]

Public Class Methods

new(source) click to toggle source
# File lib/rspec-search-and-destroy/reorder_and_filter.rb, line 5
def initialize(source)
  @source = source
end

Public Instance Methods

block() click to toggle source
# File lib/rspec-search-and-destroy/reorder_and_filter.rb, line 9
def block
  lambda do |examples|
    locations = source.example_locations_to_run

    enabled_examples = examples.select do |e|
      locations.include? e.location
    end

    enabled_examples.sort_by do |e|
      locations.index(e.location)
    end
  end
end