Sha256: 4d7060d8678da12f1c85be4cd7b138d349c0dee78abfc70efd20f8d69db457c2
Contents?: true
Size: 1.03 KB
Versions: 328
Compression:
Stored size: 1.03 KB
Contents
require 'helper' module SQLite3 class TestDatabaseReadonly < SQLite3::TestCase def setup File.unlink 'test-readonly.db' if File.exist?('test-readonly.db') @db = SQLite3::Database.new('test-readonly.db') @db.execute("CREATE TABLE foos (id integer)") @db.close end def teardown @db.close unless @db.closed? File.unlink 'test-readonly.db' if File.exist?('test-readonly.db') end def test_open_readonly_database @db = SQLite3::Database.new('test-readonly.db', :readonly => true) assert @db.readonly? end def test_open_readonly_not_exists_database File.unlink 'test-readonly.db' assert_raise(SQLite3::CantOpenException) do @db = SQLite3::Database.new('test-readonly.db', :readonly => true) end end def test_insert_readonly_database @db = SQLite3::Database.new('test-readonly.db', :readonly => true) assert_raise(SQLite3::ReadOnlyException) do @db.execute("INSERT INTO foos (id) VALUES (12)") end end end end
Version data entries
328 entries across 295 versions & 12 rubygems