Skip to content
Browse files

Confirm connection is not established if file exists.

  • Loading branch information...
1 parent 619453d commit 8aaeaf6f90f5ff5e32a9d5ce56815ab0acbcc2d5 @pat pat committed Jun 17, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 activerecord/test/cases/sqlite_rake_test.rb
View
11 activerecord/test/cases/sqlite_rake_test.rb
@@ -1,7 +1,7 @@
require 'cases/helper'
module ActiveRecord
- class SqliteRakeTest < ActiveRecord::TestCase
+ class SqliteDBCreateTest < ActiveRecord::TestCase
def setup
@database = "db_create.sqlite3"
@connection = stub :connection
@@ -29,6 +29,15 @@ def test_db_create_when_file_exists
ActiveRecord::Tasks::DatabaseTasks.create @configuration
end
+ def test_db_create_with_file_does_nothing
+ File.stubs(:exist?).returns(true)
+ $stderr.stubs(:puts).returns(nil)
+
+ ActiveRecord::Base.expects(:establish_connection).never
+
+ ActiveRecord::Tasks::DatabaseTasks.create @configuration
+ end
+
def test_db_create_establishes_a_connection
ActiveRecord::Base.expects(:establish_connection).with(@configuration)

0 comments on commit 8aaeaf6

Please sign in to comment.
Something went wrong with that request. Please try again.