Sha256: 1422bccda22701ffdbb9799e0cca9eb07570c51162bd24a133347c1b734e327a

Contents?: true

Size: 652 Bytes

Versions: 38

Compression:

Stored size: 652 Bytes

Contents

require 'spec_helper'

describe 'source is rewinded before read' do
  before { allow(Saviour::Config).to receive(:storage).and_return(Saviour::LocalStorage.new(local_prefix: @tmpdir, public_url_prefix: "http://domain.com")) }

  it do
    uploader = Class.new(Saviour::BaseUploader) {
      store_dir { "/store/dir/#{model.id}" }
    }
    klass = Class.new(Test) { include Saviour::Model }
    klass.attach_file :file, uploader

    with_test_file("example.xml") do |file|
      a = klass.create! file: file
      b = klass.create! file: file

      expect(a.file.read.bytesize).to eq 409
      expect(b.file.read.bytesize).to eq 409
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
saviour-0.6.10 spec/feature/rewind_source_before_read_spec.rb
saviour-0.6.9 spec/feature/rewind_source_before_read_spec.rb
saviour-0.6.8 spec/feature/rewind_source_before_read_spec.rb
saviour-0.6.7 spec/feature/rewind_source_before_read_spec.rb
saviour-0.6.6 spec/feature/rewind_source_before_read_spec.rb
saviour-0.6.5 spec/feature/rewind_source_before_read_spec.rb
saviour-0.6.4 spec/feature/rewind_source_before_read_spec.rb
saviour-0.6.3 spec/feature/rewind_source_before_read_spec.rb
saviour-0.6.2 spec/feature/rewind_source_before_read_spec.rb
saviour-0.6.1 spec/feature/rewind_source_before_read_spec.rb
saviour-0.6.0 spec/feature/rewind_source_before_read_spec.rb
saviour-0.5.11 spec/feature/rewind_source_before_read_spec.rb
saviour-0.5.10 spec/feature/rewind_source_before_read_spec.rb
saviour-0.5.9 spec/feature/rewind_source_before_read_spec.rb
saviour-0.5.8 spec/feature/rewind_source_before_read_spec.rb
saviour-0.5.7 spec/feature/rewind_source_before_read_spec.rb
saviour-0.5.6 spec/feature/rewind_source_before_read_spec.rb
saviour-0.5.5 spec/feature/rewind_source_before_read_spec.rb
saviour-0.5.4 spec/feature/rewind_source_before_read_spec.rb
saviour-0.5.3 spec/feature/rewind_source_before_read_spec.rb