Sha256: 584f8a438df2eb386719dc5833b1c990ca551e45f593418d9a2836c0a0eea38a

Contents?: true

Size: 792 Bytes

Versions: 33

Compression:

Stored size: 792 Bytes

Contents

require 'helper'

module SQLite3
  class TestDatabaseReadonly < Test::Unit::TestCase
    def setup
      File.unlink 'test-readonly.db' if File.exists?('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'
    end

    def test_open_readonly_database
      @db = SQLite3::Database.new('test-readonly.db', :readonly => true)
      assert @db.readonly?
    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

33 entries across 33 versions & 5 rubygems

Version Path
sqlite3-1.3.5-x86-mingw32 test/test_database_readonly.rb
sqlite3-1.3.5 test/test_database_readonly.rb
sqlite3-1.3.4-x86-mswin32-60 test/test_database_readonly.rb
sqlite3-1.3.4-x86-mingw32 test/test_database_readonly.rb
sqlite3-1.3.4 test/test_database_readonly.rb
dawanda-sqlite3-1.3.3 test/test_database_readonly.rb
sqlite3-1.3.3-x86-mswin32-60 test/test_database_readonly.rb
sqlite3-1.3.3-x86-mingw32 test/test_database_readonly.rb
sqlite3-1.3.3 test/test_database_readonly.rb
sqlite3-1.3.3.beta.1 test/test_database_readonly.rb
sqlite3-ruby-1.3.2 test/test_database_readonly.rb
sqlite3-ruby-1.3.2-x86-mswin32-60 test/test_database_readonly.rb
sqlite3-ruby-1.3.2-x86-mingw32 test/test_database_readonly.rb