Sha256: 79c6c39497b9690dbc74e9978b54d7076e5221b97fc44ae3e019a4a6433c8db3

Contents?: true

Size: 654 Bytes

Versions: 5

Compression:

Stored size: 654 Bytes

Contents

require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")

describe "error_sql extension" do
  before do
    @db = Sequel.mock(:fetch=>proc{|sql| @db.log_connection_yield(sql, nil){raise StandardError}}).extension(:error_sql)
  end

  it "should have Sequel::DatabaseError#sql give the SQL causing the error" do
    @db["SELECT"].all rescue (e = $!)
    e.sql.must_equal "SELECT"
  end

  it "should have Sequel::DatabaseError#sql give the SQL causing the error when using a logger" do
    l = Object.new
    def l.method_missing(*) end
    @db.loggers = [l]
    @db["SELECT"].all rescue (e = $!)
    e.sql.must_equal "SELECT"
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
sequel-4.49.0 spec/extensions/error_sql_spec.rb
sequel-4.48.0 spec/extensions/error_sql_spec.rb
tdiary-5.0.5 vendor/bundle/gems/sequel-4.47.0/spec/extensions/error_sql_spec.rb
sequel-4.47.0 spec/extensions/error_sql_spec.rb
sequel-4.46.0 spec/extensions/error_sql_spec.rb