module RSpec::Preconditions::ClassMethods

Public Instance Methods

preconditions(&block) click to toggle source
# File lib/rspec/preconditions.rb, line 7
def preconditions(&block)
  before(:each) do |current_example|
    begin
      # Run the block in the context of the current_example.
      # This doesn't run the current_example.
      RSpec::Core::Hooks::BeforeHook.new(block).run(current_example)
    rescue RSpec::Expectations::ExpectationNotMetError, StandardError
      mark_remaining_examples_pending(current_example)
      raise
    end
  end
end