File: test_integration_open_close.rb

package info (click to toggle)
ruby-sqlite3 2.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 680 kB
  • sloc: ruby: 4,827; ansic: 1,868; sh: 91; makefile: 7
file content (34 lines) | stat: -rw-r--r-- 713 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require "helper"

class IntegrationOpenCloseTestCase < SQLite3::TestCase
  def test_create_close
    db = SQLite3::Database.new("test-create.db")
    assert_path_exists "test-create.db"
    assert_nothing_raised { db.close }
  ensure
    begin
      File.delete("test-create.db")
    rescue
      nil
    end
  end

  def test_open_close
    File.open("test-open.db", "w") { |f| }
    assert_path_exists "test-open.db"
    db = SQLite3::Database.new("test-open.db")
    assert_nothing_raised { db.close }
  ensure
    begin
      File.delete("test-open.db")
    rescue
      nil
    end
  end

  def test_bad_open
    assert_raise(SQLite3::CantOpenException) do
      SQLite3::Database.new(".")
    end
  end
end