Sha256: 8bd317ab1c71eecd4c9c2bfddd2573be148067306364913d59d486f7d90858ab

Contents?: true

Size: 874 Bytes

Versions: 2

Compression:

Stored size: 874 Bytes

Contents

require 'pathname'
require Pathname(__FILE__).dirname.expand_path.parent + 'spec_helper'

unless JRUBY

  describe DataObjects::Sqlite3::Command do

    before(:each) do
      @connection = DataObjects::Connection.new("sqlite3://#{File.expand_path(File.dirname(__FILE__))}/test.db")
      @command = @connection.create_command("INSERT INTO users (name) VALUES (?)")
    end

    it "should properly quote a string" do
      @command.quote_string("O'Hare").should == "'O''Hare'"
      @command.quote_string("Willy O'Hare & Johnny O'Toole").should == "'Willy O''Hare & Johnny O''Toole'"
      @command.quote_string("Billy\\Bob").should == "'Billy\\Bob'"
      @command.quote_string("The\\Backslasher\\Rises\\Again").should == "'The\\Backslasher\\Rises\\Again'"
      @command.quote_string("Scott \"The Rage\" Bauer").should == "'Scott \"The Rage\" Bauer'"
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
do_sqlite3-0.9.11-x86-mswin32-60 spec/integration/quoting_spec.rb
do_sqlite3-0.9.11 spec/integration/quoting_spec.rb