Sha256: e27431a359ed641a7164b13d515dbac63b04e7bddc1fa6aa363a5f4a2e3ef911
Contents?: true
Size: 1.74 KB
Versions: 4
Compression:
Stored size: 1.74 KB
Contents
require 'spec_helper' require 'sequel' describe Upsert do describe "Plays nice with Sequel" do config = ActiveRecord::Base.connection.instance_variable_get(:@config) config[:adapter] = case config[:adapter] when 'postgresql' then 'postgres' when 'sqlite3' then 'sqlite' else config[:adapter] end let(:db) do if RUBY_PLATFORM == "java" Sequel.connect( RawConnectionFactory::CONFIG, :user => RawConnectionFactory::DB_USER, :password => RawConnectionFactory::DB_PASSWORD ) elsif config[:adapter] == "sqlite" Sequel.sqlite("temp.db") else Sequel.connect(config.merge( :user => config.values_at(:user, :username).compact.first, :host => config.values_at(:host, :hostaddr).compact.first, :database => config.values_at(:database, :dbname).compact.first )) end end it "Doesn't explode on connection" do expect { db }.to_not raise_error end it "Doesn't explode when using DB.pool.hold" do db.pool.hold do |conn| expect { upsert = Upsert.new(conn, :pets) assert_creates(Pet, [{:name => 'Jerry', :gender => 'male'}]) do upsert.row({:name => 'Jerry'}, {:gender => 'male'}) end }.to_not raise_error end end it "Doesn't explode when using DB.synchronize" do db.synchronize do |conn| expect { upsert = Upsert.new(conn, :pets) assert_creates(Pet, [{:name => 'Jerry', :gender => 'male'}]) do upsert.row({:name => 'Jerry'}, {:gender => 'male'}) end }.to_not raise_error end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
upsert-2.9.10-java | spec/sequel_spec.rb |
upsert-2.9.10 | spec/sequel_spec.rb |
upsert-2.9.9-universal-java-11 | spec/sequel_spec.rb |
upsert-2.9.9 | spec/sequel_spec.rb |