saviour 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b107bdd95902dd59c6c15aa4a50a90e7b4ca737134699c645cd1695ab48f5838
4
- data.tar.gz: 7a26eebf7158b92695aa620697a782a01bad6edf6922170bc888c74e8dd9e2ac
3
+ metadata.gz: '084a405456f0b11741e0f8a92a96a85620b26aca9209b53835acfecebaf13fdc'
4
+ data.tar.gz: 20e26cc51b5d6867907c9f656169d9929a4d3e3fe081c22d9cb28ec972557149
5
5
  SHA512:
6
- metadata.gz: 3158dddca42f717a88e3786466dccd543fdce85427391ccc32d7f2e17008d2d184b2bfbea3ad0709f17e3cd288e746f618d98b8d7c66ca000e8fde1be71e2e64
7
- data.tar.gz: ccc38ba832bec902e9e30322641f802d049887621b9630cbebfe179c0b6af080d50670fd77f417720afe44c908f86ac2b930b0a8be7d914e6e3289a96d8929b0
6
+ metadata.gz: edffce475e7dc22aca7fc71c2a96867eff9ad24d4c4fd1284420247c00dac571630a5117345900fb03288ebd7d97cff81bf395cfa71a2da029b2f71aab434164
7
+ data.tar.gz: 7a58495b5e89f4b04724c0364d90f25885dff7105b3b0cdf175296b2125d699c364e4986812d91d21e4946f135dc68e92cddf8a3eea7e6aedbe65a87dd2d009e
data/lib/saviour/file.rb CHANGED
@@ -59,7 +59,7 @@ module Saviour
59
59
 
60
60
  if persisted?
61
61
  new_file.assign(Saviour::StringSource.new(read, filename))
62
- else
62
+ elsif @source
63
63
  new_file.assign(Saviour::StringSource.new(source_data, filename_to_be_assigned))
64
64
  end
65
65
 
@@ -1,3 +1,3 @@
1
1
  module Saviour
2
- VERSION = "0.5.5"
2
+ VERSION = "0.5.6"
3
3
  end
@@ -193,6 +193,28 @@ describe "saving a new file" do
193
193
  }
194
194
  }
195
195
 
196
+ it "with no attachment" do
197
+ a = klass.create!
198
+ b = a.dup
199
+ b.save!
200
+ expect(b[:file]).to be_nil
201
+ end
202
+
203
+ it "on non persisted object with no attachment" do
204
+ a = klass.new
205
+ b = a.dup
206
+ b.save!
207
+ expect(b[:file]).to be_nil
208
+ end
209
+
210
+ it "on non persisted object with attachment" do
211
+ a = klass.new file: Saviour::StringSource.new("contents", "file.txt")
212
+ b = a.dup
213
+ b.save!
214
+ expect(b[:file]).to_not be_nil
215
+ expect(Saviour::Config.storage.exists?(b[:file])).to be_truthy
216
+ end
217
+
196
218
  it "creates a non persisted file attachment" do
197
219
  a = klass.create! file: Saviour::StringSource.new("contents", "file.txt")
198
220
  expect(Saviour::Config.storage.exists?(a[:file])).to be_truthy
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saviour
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Campos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-01 00:00:00.000000000 Z
11
+ date: 2018-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord