Sha256: 46539eb87d97c12126a33a7a6029dce05acd7db3765659014c88faca02384566

Contents?: true

Size: 646 Bytes

Versions: 21

Compression:

Stored size: 646 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_yield(sql){raise StandardError}}).extension(:error_sql)
  end

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

  specify "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.should == "SELECT"
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
sequel-4.22.0 spec/extensions/error_sql_spec.rb
sequel-4.21.0 spec/extensions/error_sql_spec.rb
sequel-4.20.0 spec/extensions/error_sql_spec.rb
sequel-4.19.0 spec/extensions/error_sql_spec.rb
sequel-4.18.0 spec/extensions/error_sql_spec.rb
sequel-4.17.0 spec/extensions/error_sql_spec.rb
sequel-4.16.0 spec/extensions/error_sql_spec.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/sequel-4.15.0/spec/extensions/error_sql_spec.rb
sequel-4.15.0 spec/extensions/error_sql_spec.rb
sequel-4.14.0 spec/extensions/error_sql_spec.rb
sequel-4.13.0 spec/extensions/error_sql_spec.rb
sequel-4.12.0 spec/extensions/error_sql_spec.rb
sequel-4.11.0 spec/extensions/error_sql_spec.rb
sequel-4.10.0 spec/extensions/error_sql_spec.rb
sequel-4.9.0 spec/extensions/error_sql_spec.rb
sequel-4.8.0 spec/extensions/error_sql_spec.rb
sequel-4.7.0 spec/extensions/error_sql_spec.rb
sequel-4.6.0 spec/extensions/error_sql_spec.rb
sequel-4.5.0 spec/extensions/error_sql_spec.rb
sequel-4.4.0 spec/extensions/error_sql_spec.rb