Sha256: 941b27128475a850d6f7b5370f2540100592c655891444b8b43cc0ace7a5347e

Contents?: true

Size: 1017 Bytes

Versions: 3

Compression:

Stored size: 1017 Bytes

Contents

require 'rubygems'
require 'spork'

Spork.prefork do
  require 'capybara/rspec'
  require 'rack/test'
  require 'database_cleaner'

  ENV['RACK_ENV'] = 'test'

  module XhrHelpers
    def xhr(path, params = {})
      verb = params.delete(:as) || :get
      send(verb,path, params, "HTTP_X_REQUESTED_WITH" => "XMLHttpRequest")
    end
    alias_method :ajax, :xhr
  end

  RSpec.configure do |c|
    c.include Capybara::DSL
    c.include Rack::Test::Methods
    c.include XhrHelpers

    c.before(:each) do
      DatabaseCleaner.start
    end

    c.after(:each) do
      DatabaseCleaner.clean
    end

    c.before(:each, :ui => true) do
      header 'User-Agent', 'Firefox'
    end

    c.before(:each, :ui => false) do
      header 'User-Agent', nil
    end
  end
end

Spork.each_run do
  require File.expand_path('../../lib/rest-assured', __FILE__)
  require 'shoulda-matchers'

  DatabaseCleaner.strategy = :truncation

  Capybara.app = RestAssured::Application

  def app
    RestAssured::Application
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rest-assured-0.1.4 spec/spec_helper.rb
rest-assured-0.1.3 spec/spec_helper.rb
rest-assured-0.1.2 spec/spec_helper.rb