Sha256: 8d8be0a7e87881466cccf33f09ec3a8947159c26e4ca58430308ab9ed794c60a

Contents?: true

Size: 992 Bytes

Versions: 3

Compression:

Stored size: 992 Bytes

Contents

require 'ajax/rspec/extension'
require 'ajax/rspec/helpers'

# RSpec integration.  Add a before filter to disable Ajax before all tests.
# Make the methods in Ajax::RSpec::Extension available in your example groups.
#
# Call <tt>Ajax::RSpec.setup</tt> to retry adding the test integration.
# This can be useful if RSpec is not defined at the time that Ajax is initialized.
module Ajax::RSpec
  def self.setup
    if defined?(::RSpec)
      ::RSpec.configure do |c|
        c.include(Ajax::RSpec::Extension)
        c.before :all do
          Ajax.enabled = false
        end
      end
    elsif defined?(::Spec::Runner)
      ::Spec::Runner.configure do |c|
        c.include(Ajax::RSpec::Extension)
        c.before :all do
          Ajax.enabled = false
        end
      end
    elsif defined?(ActiveSupport::TestCase)
      ActiveSupport::TestCase.send(:include, Ajax::RSpec::Extension) unless ActiveSupport::TestCase.include?(Ajax::RSpec::Extension)
    end
  end
end

Ajax::RSpec.setup

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ajax-1.1.7 lib/ajax/rspec.rb
ajax-1.1.6 lib/ajax/rspec.rb
ajax-1.1.5 lib/ajax/rspec.rb