Sha256: d35f97698092cd70b66c29614e83edc3bf89c32f8904c8372fa849a05c2a6210

Contents?: true

Size: 653 Bytes

Versions: 10

Compression:

Stored size: 653 Bytes

Contents

shared_examples_for 'supports binary upserts' do
  before do
    @fakes = []
    10.times do
      @fakes << [Faker::Name.name, Faker::Lorem.paragraphs(10).join("\n\n")]
    end
  end
  it "saves binary one by one" do
    @fakes.each do |name, biography|
      zipped_biography = Zlib::Deflate.deflate biography
      upsert = Upsert.new connection, :pets
      assert_creates(Pet, [{:name => name, :zipped_biography => zipped_biography}]) do
        upsert.row({:name => name}, {:zipped_biography => Upsert.binary(zipped_biography)})
      end
      Zlib::Inflate.inflate(Pet.find_by_name(name).zipped_biography).must_equal biography
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
upsert-0.3.4 test/shared/binary.rb
upsert-0.3.3 test/shared/binary.rb
upsert-0.3.2 test/shared/binary.rb
upsert-0.3.1 test/shared/binary.rb
upsert-0.3.0 test/shared/binary.rb
upsert-0.2.2 test/shared/binary.rb
upsert-0.2.1 test/shared/binary.rb
upsert-0.2.0 test/shared/binary.rb
upsert-0.1.2 test/shared/binary.rb
upsert-0.1.1 test/shared/binary.rb