Sha256: 23a5a51738cf53533b787f6196ce760853611051c82912ce587bebac2efcd720

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

require 'spec_helper'
describe Upsert do
  describe "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 $conn, :pets
        assert_creates(Pet, [{:name => name, :zipped_biography => zipped_biography}]) do
          upsert.row({:name => name}, {:zipped_biography => Upsert.binary(zipped_biography)})
          # binding.pry
        end

        Zlib::Inflate.inflate(Pet.find_by_name(name).zipped_biography).should == biography
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
upsert-1.0.2 spec/binary_spec.rb
upsert-0.5.0 spec/binary_spec.rb