Sha256: 22ef79f10a0715ef7b956c159b6963c8663efea933ffb4a89ce6e19656af3dc8

Contents?: true

Size: 829 Bytes

Versions: 10

Compression:

Stored size: 829 Bytes

Contents

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

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
do_sqlite3-0.9.3 spec/integration/quoting_spec.rb
do_sqlite3-0.9.2 spec/integration/quoting_spec.rb
do_sqlite3-0.9.4 spec/integration/quoting_spec.rb
do_sqlite3-0.9.6-x86-mswin32-60 spec/integration/quoting_spec.rb
do_sqlite3-0.9.5 spec/integration/quoting_spec.rb
do_sqlite3-0.9.6 spec/integration/quoting_spec.rb
do_sqlite3-0.9.7 spec/integration/quoting_spec.rb
do_sqlite3-0.9.8 spec/integration/quoting_spec.rb
do_sqlite3-0.9.9-x86-mswin32-60 spec/integration/quoting_spec.rb
do_sqlite3-0.9.9 spec/integration/quoting_spec.rb