Module: Rspec::Rails23::Configuration

Defined in:
lib/rspec/rails23/configuration.rb

Instance Method Summary collapse

Instance Method Details

#enable_active_record_transactional_support(filter_options = {}) ⇒ Object

:behaviour => { :describes => lambda { |dt| dt < ActiveRecord::Base }



11
12
13
# File 'lib/rspec/rails23/configuration.rb', line 11

def enable_active_record_transactional_support(filter_options={})
  RSpec.configuration.extend(::Rspec::Rails23::TransactionalDatabaseSupport, filter_options)
end

#enable_controller_support(filter_options = {}) ⇒ Object

:behaviour => { :describes => lambda { |dt| dt < ActionController::Base }



21
22
23
# File 'lib/rspec/rails23/configuration.rb', line 21

def enable_controller_support(filter_options={})
  RSpec.configuration.extend(::Rspec::Rails23::Controllers, filter_options)
end

#enable_helper_support(filter_options = {}) ⇒ Object

:behaviour => { :describes => lambda { |dt| dt.to_s.ends_with?(‘Helper’) }



16
17
18
# File 'lib/rspec/rails23/configuration.rb', line 16

def enable_helper_support(filter_options={})
  RSpec.configuration.extend(::Rspec::Rails23::Helpers, filter_options)
end

#enable_rails_specific_mocking_extensions(filter_options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/rspec/rails23/configuration.rb', line 25

def enable_rails_specific_mocking_extensions(filter_options={})
  case RSpec.configuration.mock_framework.to_s
  when /mocha/i
    require 'rspec/rails23/mocking/with_mocha'
    RSpec.configuration.include(::Rspec::Rails23::Mocking::WithMocha, filter_options)
   when /rr/i
    require 'rspec/rails23/mocking/with_rr'
    RSpec.configuration.include(::Rspec::Rails23::Mocking::WithRR, filter_options)
  end
end

#enable_reasonable_defaults!Object



36
37
38
39
40
41
# File 'lib/rspec/rails23/configuration.rb', line 36

def enable_reasonable_defaults!
  enable_active_record_transactional_support
  enable_helper_support :behaviour => { :describes => lambda { |dt| dt.to_s.ends_with?('Helper') } }
  enable_controller_support :behaviour => { :describes => lambda { |dt| dt < ::ActionController::Base } }
  enable_rails_specific_mocking_extensions
end

#railsObject



6
7
8
# File 'lib/rspec/rails23/configuration.rb', line 6

def rails
  self
end