123456789_123456789_123456789_123456789_123456789_

Module: RSpec::Rails::SetupAndTeardownAdapter::ClassMethods Private

Instance Method Summary

Instance Method Details

#setup(*methods, &block)

Wraps setup calls from within Rails’ testing framework in before hooks.

[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/adapters.rb', line 108

def setup(*methods, &block)
  methods.each do |method|
    if method.to_s =~ /^setup_(with_controller|fixtures|controller_request_and_response)$/
      prepend_before { __send__ method }
    else
      before         { __send__ method }
    end
  end
  before(&block) if block
end

#teardown(*methods, &block)

This method is for internal use only.

Wraps teardown calls from within Rails’ testing framework in after hooks.

[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/adapters.rb', line 123

def teardown(*methods, &block)
  methods.each { |method| after { __send__ method } }
  after(&block) if block
end