aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb
blob: b1b4463bf10a7734dbf193c2d09b653b23b190f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require "cases/helper"
require "models/owner"

module ActiveRecord
  module ConnectionAdapters
    class SQLite3CreateFolder < ActiveRecord::SQLite3TestCase
      def test_sqlite_creates_directory
        Dir.mktmpdir do |dir|
          begin
            dir = Pathname.new(dir)
            @conn = Base.sqlite3_connection database: dir.join("db/foo.sqlite3"),
                                 adapter: "sqlite3",
                                 timeout: 100

            assert Dir.exist? dir.join("db")
            assert File.exist? dir.join("db/foo.sqlite3")
          ensure
            @conn.disconnect! if @conn
          end
        end
      end
    end
  end
end