Sha256: fa7dc7bb105e1a8b1f36e6e3907486b278a3afe9f86bf8d000cd73060f6ee6f3

Contents?: true

Size: 1.87 KB

Versions: 10

Compression:

Stored size: 1.87 KB

Contents

# Configure Rails Envinronment
ENV["RAILS_ENV"] = "test"

require File.expand_path("../dummy/config/environment.rb",  __FILE__)
require "rspec/rails"
require 'webmock/rspec'

ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.default_url_options[:host] = "test.com"

Rails.backtrace_cleaner.remove_silencers!

# Configure capybara for integration testing
# don't know enough about capybara now. 
# might bring this back later.
#require "capybara/rails"
#Capybara.default_driver   = :rack_test
#Capybara.default_selector = :css


# Run any available migration
# need to move this into a before block
# ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

RSpec.configure do |config|
  
  # run only the debug tests
  # config.filter_run :debug => true
  
  # Remove this line if you don't want RSpec's should and should_not
  # methods or matchers
  require 'rspec/expectations'
  config.include RSpec::Matchers
  
  # == Mock Framework
  config.mock_with :rspec

  config.fixture_path = "#{File.dirname(__FILE__)}/fixtures"
  
  config.before(:all){
    
    #change this if sqlite is unavailable
    dbconfig = {
      :adapter => 'sqlite3',
      :database => ':memory:'
    }
    
    ::ActiveRecord::Base.establish_connection(dbconfig)
    ::ActiveRecord::Migration.verbose = false
    
    ::ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
  }
  
  config.after(:all){
    ::ActiveRecord::Migrator.down File.expand_path("../dummy/db/migrate/", __FILE__)
  }
end

 # webmock
def webmock_site_base_dir
  "../fixtures" 
end

def webmock_filename(f)
  File.join Rails.root, webmock_site_base_dir, f
end

def webmock_file(f = nil)
  f ||= "%s.xml" % @site.anchor
  File.new webmock_filename(f)
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
phocoder-rails-0.0.42 spec/spec_helper.rb
phocoder-rails-0.0.41 spec/spec_helper.rb
phocoder-rails-0.0.40 spec/spec_helper.rb
phocoder-rails-0.0.39 spec/spec_helper.rb
phocoder-rails-0.0.38 spec/spec_helper.rb
phocoder-rails-0.0.37 spec/spec_helper.rb
phocoder-rails-0.0.36 spec/spec_helper.rb
phocoder-rails-0.0.35 spec/spec_helper.rb
phocoder-rails-0.0.34 spec/spec_helper.rb
phocoder-rails-0.0.33 spec/spec_helper.rb