Skip to content

Commit

Permalink
Remove dep on Spork. Only define AppConfig once.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickstenning committed Dec 12, 2009
1 parent adcbc4f commit 960cc6d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 25 deletions.
8 changes: 5 additions & 3 deletions config/environment.rb
Expand Up @@ -29,7 +29,6 @@
config.gem 'haml'
config.gem 'rspec', :lib => 'spec'
config.gem 'rspec-rails', :lib => 'spec/rails'
config.gem 'spork'

# Only load the plugins named here, in the order given. By default, all plugins
# in vendor/plugins are loaded in alphabetical order.
Expand Down Expand Up @@ -77,7 +76,10 @@
require 'ostruct'
require 'yaml'

config = OpenStruct.new(YAML.load_file("#{RAILS_ROOT}/config/archives.yml"))
::AppConfig = OpenStruct.new(config.send(RAILS_ENV))

unless Object.const_defined?('AppConfig')
config = OpenStruct.new(YAML.load_file("#{RAILS_ROOT}/config/archives.yml"))
::AppConfig = OpenStruct.new(config.send(RAILS_ENV))
end

class ConfigurationError < RuntimeError; end
3 changes: 1 addition & 2 deletions spec/spec.opts
@@ -1,5 +1,4 @@
--colour
--format progress
--loadby mtime
--reverse
--drb
--reverse
34 changes: 14 additions & 20 deletions spec/spec_helper.rb
@@ -1,25 +1,19 @@
require 'rubygems'
require 'spork'

Spork.prefork do
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment"
require 'spec/autorun'
require 'spec/rails'
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment"
require 'spec/autorun'
require 'spec/rails'

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

Spec::Runner.configure do |config|
# If you're not using ActiveRecord you should remove these
# lines, delete config/database.yml and disable :active_record
# in your config/boot.rb
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
end
end

Spork.each_run do
Spec::Runner.configure do |config|
# If you're not using ActiveRecord you should remove these
# lines, delete config/database.yml and disable :active_record
# in your config/boot.rb
config.use_transactional_fixtures = true
config.use_instantiated_fixtures = false
config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
end

0 comments on commit 960cc6d

Please sign in to comment.