Skip to content

Commit

Permalink
makes rspec run without a rails app enclosing it
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwhite committed Sep 10, 2010
1 parent e9541ee commit b53b0ec
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
10 changes: 10 additions & 0 deletions spec/app.rb
@@ -1,9 +1,19 @@
# Testing app setup

module ResourcesControllerTest
class Application < Rails::Application
config.paths.database = File.expand_path('../app/database.yml', __FILE__)
config.paths.log = File.expand_path('../../../tmp/log', __FILE__)
end
end

ResourcesControllerTest::Application.initialize!

##########
# Routing
##########

Rails.application
Rails.application.routes.clear!
Rails.application.routes.draw do |map|
# this tests :resource_path (or :erp), for named routes that map to resources
Expand Down
5 changes: 5 additions & 0 deletions spec/app/database.yml
@@ -0,0 +1,5 @@
test:
adapter: sqlite3
database: tmp/test.sqlite3
pool: 5
timeout: 5000
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
@@ -1,7 +1,8 @@
ENV["RAILS_ENV"] ||= "test"
require File.join(File.dirname(__FILE__), "../../../../config/environment")
require 'rails/all'
require 'rspec'
require 'rspec/rails'
require File.expand_path('../../lib/resources_controller', __FILE__)

# RSpec 2 doesn't fight Rails's requiring a template for rendering,
# even in controller specs, so we need to provide empty ones in order to not have
Expand All @@ -12,3 +13,5 @@
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
end

require File.dirname(__FILE__) + '/app'

0 comments on commit b53b0ec

Please sign in to comment.