Module: RSpec::Rails::SetupAndTeardownAdapter::ClassMethods Private
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Extended In:
::RSpec::Rails::ChannelExampleGroup ,
::RSpec::Rails::ControllerExampleGroup ,
::RSpec::Rails::FeatureExampleGroup ,
::RSpec::Rails::FixtureSupport ,
::RSpec::Rails::HelperExampleGroup ,
::RSpec::Rails::JobExampleGroup ,
::RSpec::Rails::MailerExampleGroup ,
::RSpec::Rails::ModelExampleGroup ,
::RSpec::Rails::RailsExampleGroup ,
::RSpec::Rails::RequestExampleGroup ,
::RSpec::Rails::RoutingExampleGroup ,
::RSpec::Rails::SystemExampleGroup ,
::RSpec::Rails::ViewExampleGroup
| |
Defined in: | rspec-rails/lib/rspec/rails/adapters.rb |
Instance Method Summary
-
#setup(*methods, &block)
Internal use only
Wraps #setup calls from within Rails’ testing framework in
before
hooks. -
#teardown(*methods, &block)
Internal use only
Internal use only
Wraps #teardown calls from within Rails’ testing framework in
after
hooks.
Instance Method Details
#setup(*methods, &block)
Wraps setup
calls from within Rails’ testing framework in before
hooks.
# 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.
# 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