Sha256: de6f382f59a211d10b4c339d51c1219eec2a9be405f3cb4d18edf8155b7e42a2

Contents?: true

Size: 883 Bytes

Versions: 1

Compression:

Stored size: 883 Bytes

Contents

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

unless JRUBY
  describe DataObjects::Postgres::Command do

    before(:each) do
      @connection = DataObjects::Connection.new(DO_POSTGRES_SPEC_URI)
      @command = @connection.create_command("INSERT INTO users (name) VALUES (?)")
    end

    after(:each) do
      @connection.close
    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

1 entries across 1 versions & 1 rubygems

Version Path
do_postgres-0.9.11 spec/integration/quoting_spec.rb