Permalink
Browse files

Removing db/seeds.rb is fine. Don't blow up.

  • Loading branch information...
1 parent e848bca commit eabda416b7c66f3b8d03237e7334bd2d14ff9190 @jeremy jeremy committed Oct 29, 2011
Showing with 8 additions and 2 deletions.
  1. +1 −1 railties/lib/rails/engine.rb
  2. +7 −1 railties/test/railties/engine_test.rb
@@ -488,7 +488,7 @@ def config
# Blog::Engine.load_seed
def load_seed
seed_file = paths["db/seeds"].existent.first
- load(seed_file) if File.exist?(seed_file)
+ load(seed_file) if seed_file && File.exist?(seed_file)
end
# Add configured load paths to ruby load paths and remove duplicates.
@@ -455,12 +455,18 @@ def index
Rails.application.load_seed
assert Rails.application.config.app_seeds_loaded
- assert_raise(NoMethodError) do Bukkits::Engine.config.bukkits_seeds_loaded end
+ assert_raise(NoMethodError) { Bukkits::Engine.config.bukkits_seeds_loaded }
Bukkits::Engine.load_seed
assert Bukkits::Engine.config.bukkits_seeds_loaded
end
+ test "skips nonexistent seed data" do
+ FileUtils.rm "#{app_path}/db/seeds.rb"
+ boot_rails
+ assert_nil Rails.application.load_seed
+ end
+
test "using namespace more than once on one module should not overwrite _railtie method" do
@plugin.write "lib/bukkits.rb", <<-RUBY
module AppTemplate

0 comments on commit eabda41

Please sign in to comment.