2011-02-05 13:32:10 +00:00
|
|
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
|
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2011-02-05 13:54:09 +00:00
|
|
|
require 'active_support/all'
|
|
|
|
require 'active_record'
|
|
|
|
require 'rails'
|
|
|
|
require 'action_controller/railtie'
|
|
|
|
require 'action_view/railtie'
|
|
|
|
require 'rspec/rails'
|
|
|
|
|
|
|
|
ActiveRecord::Base.configurations = {'test' => {:adapter => 'sqlite3', :database => ':memory:'}}
|
|
|
|
ActiveRecord::Base.establish_connection('test')
|
|
|
|
|
2011-02-05 13:32:10 +00:00
|
|
|
require 'kaminari'
|
|
|
|
|
2011-02-05 13:54:09 +00:00
|
|
|
app = Class.new(Rails::Application)
|
|
|
|
app.config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"
|
|
|
|
app.config.session_store :cookie_store, :key => "_myapp_session"
|
|
|
|
app.config.active_support.deprecation = :log
|
|
|
|
app.initialize!
|
|
|
|
|
|
|
|
app.routes.draw do
|
|
|
|
resources :users
|
|
|
|
end
|
|
|
|
|
|
|
|
Object.const_set(:ApplicationHelper, Module.new)
|
|
|
|
|
2011-02-05 13:32:10 +00:00
|
|
|
# Requires supporting files with custom matchers and macros, etc,
|
|
|
|
# in ./support/ and its subdirectories.
|
|
|
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
2011-02-05 13:54:09 +00:00
|
|
|
config.mock_with :rr
|
|
|
|
config.before :all do
|
|
|
|
# ActiveRecord::Base.connection.execute 'CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))' unless ActiveRecord::Base.connection.table_exists? 'users'
|
|
|
|
CreateUsers.up unless ActiveRecord::Base.connection.table_exists? 'users'
|
|
|
|
end
|
2011-02-05 13:32:10 +00:00
|
|
|
end
|