Module: Selective::Ruby::RSpec::Monkeypatches::Configuration

Defined in:
lib/selective/ruby/rspec/monkeypatches.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#currently_loading_spec_fileObject

Returns the value of attribute currently_loading_spec_file.



61
62
63
# File 'lib/selective/ruby/rspec/monkeypatches.rb', line 61

def currently_loading_spec_file
  @currently_loading_spec_file
end

Instance Method Details

#after_suite_hooksObject



86
87
88
89
90
91
92
# File 'lib/selective/ruby/rspec/monkeypatches.rb', line 86

def after_suite_hooks
  return if dry_run?

  ::RSpec.current_scope = :after_suite_hook
  run_suite_hooks("an `after(:suite)` hook", @after_suite_hooks)
  ::RSpec.current_scope = :suite
end

#get_files_to_run(*args) ⇒ Object



70
71
72
# File 'lib/selective/ruby/rspec/monkeypatches.rb', line 70

def get_files_to_run(*args)
  super.reject { |f| loaded_spec_files.member?(f) }
end

#load_file_handling_errors(method, file) ⇒ Object



63
64
65
66
67
68
# File 'lib/selective/ruby/rspec/monkeypatches.rb', line 63

def load_file_handling_errors(method, file)
  self.currently_loading_spec_file = file
  super
ensure
  self.currently_loading_spec_file = nil
end

#with_suite_hooksObject



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/selective/ruby/rspec/monkeypatches.rb', line 74

def with_suite_hooks
  return yield if dry_run?

  unless @before_suite_hooks_run
    ::RSpec.current_scope = :before_suite_hook
    run_suite_hooks("a `before(:suite)` hook", @before_suite_hooks)
    @before_suite_hooks_run = true
  end

  yield
end