Sha256: c9801277941313371ffa42fe9684734501a56e024f12efa5c7c33f680fc17d62

Contents?: true

Size: 782 Bytes

Versions: 10

Compression:

Stored size: 782 Bytes

Contents

require 'spec_helper'

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

  context "updates the Saviour::File instance" do
    it do
      uploader = Class.new(Saviour::BaseUploader) { store_dir { "/store/dir" } }
      klass = Class.new(Test) { include Saviour::Model }
      klass.attach_file :file, uploader
      a = klass.create!
      b = klass.find(a.id)

      with_test_file("example.xml") do |example|
        a.update_attributes! file: example
        expect(a.file.exists?).to be_truthy
        expect(b.file.exists?).to be_falsey

        b.reload(lock: false)
        expect(b.file.exists?).to be_truthy
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
saviour-0.5.6 spec/feature/reload_model_spec.rb
saviour-0.5.5 spec/feature/reload_model_spec.rb
saviour-0.5.4 spec/feature/reload_model_spec.rb
saviour-0.5.3 spec/feature/reload_model_spec.rb
saviour-0.5.2 spec/feature/reload_model_spec.rb
saviour-0.5.1 spec/feature/reload_model_spec.rb
saviour-0.5.0 spec/feature/reload_model_spec.rb
saviour-0.4.14 spec/feature/reload_model_spec.rb
saviour-0.4.13 spec/feature/reload_model_spec.rb
saviour-0.4.12 spec/feature/reload_model_spec.rb