saviour 0.5.6 → 0.5.7
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 +4 -4
- data/lib/saviour/file.rb +4 -0
- data/lib/saviour/integrator.rb +4 -0
- data/lib/saviour/version.rb +1 -1
- data/spec/feature/crud_workflows_spec.rb +19 -1
- data/spec/feature/reload_model_spec.rb +18 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c4a0898f2a80dfb611406f5d9ad72a6abdd8a1dc36716013f7d6c375041a603
|
4
|
+
data.tar.gz: b394cc24a4e380a64948026543489c2f9f40cdc91023d6009642b351e3162dea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33b0babd6aac01fda54898026e70fb717b65819c7cbddfc721baa6c0ec5f2bff19b05edbe7b465ff972e3c9ce14db9a9a8ceee180f073d92f92b8c7741fc3748
|
7
|
+
data.tar.gz: ac423bdfc6ed48c368ca92e6e4aeca395ceb51ae4d14d363971b27d656777e8974c5514a6db959ca89154c95c5a8fc484cdad26e478198ea17775abda466250a
|
data/lib/saviour/file.rb
CHANGED
data/lib/saviour/integrator.rb
CHANGED
data/lib/saviour/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "
|
3
|
+
describe "CRUD" do
|
4
4
|
before { allow(Saviour::Config).to receive(:storage).and_return(Saviour::LocalStorage.new(local_prefix: @tmpdir, public_url_prefix: "http://domain.com")) }
|
5
5
|
|
6
6
|
let(:uploader) {
|
@@ -233,4 +233,22 @@ describe "saving a new file" do
|
|
233
233
|
expect(Saviour::Config.storage.read(a[:file])).to eq Saviour::Config.storage.read(b[:file])
|
234
234
|
end
|
235
235
|
end
|
236
|
+
|
237
|
+
describe "presence" do
|
238
|
+
it "false when no assigned file" do
|
239
|
+
a = klass.create!
|
240
|
+
expect(a.file?).to be_falsey
|
241
|
+
end
|
242
|
+
|
243
|
+
it "true when no persisted but assigned" do
|
244
|
+
a = klass.create!
|
245
|
+
a.file = Saviour::StringSource.new("contents", "file.txt")
|
246
|
+
expect(a.file?).to be_truthy
|
247
|
+
end
|
248
|
+
|
249
|
+
it "true when persisted and assigned" do
|
250
|
+
a = klass.create! file: Saviour::StringSource.new("contents", "file.txt")
|
251
|
+
expect(a.file?).to be_truthy
|
252
|
+
end
|
253
|
+
end
|
236
254
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe "reload
|
3
|
+
describe "reload" do
|
4
4
|
before { allow(Saviour::Config).to receive(:storage).and_return(Saviour::LocalStorage.new(local_prefix: @tmpdir, public_url_prefix: "http://domain.com")) }
|
5
5
|
|
6
|
-
|
6
|
+
describe "updates the Saviour::File instances on the model" do
|
7
7
|
it do
|
8
8
|
uploader = Class.new(Saviour::BaseUploader) { store_dir { "/store/dir" } }
|
9
9
|
klass = Class.new(Test) { include Saviour::Model }
|
@@ -21,4 +21,20 @@ describe "reload model" do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
it "reloads the file instance" do
|
26
|
+
uploader = Class.new(Saviour::BaseUploader) { store_dir { "/store/dir" } }
|
27
|
+
klass = Class.new(Test) { include Saviour::Model }
|
28
|
+
klass.attach_file :file, uploader
|
29
|
+
a = klass.create!
|
30
|
+
|
31
|
+
expect(a.file.present?).to be_falsey
|
32
|
+
Saviour::Config.storage.write "contents", "file.txt"
|
33
|
+
a.update_columns(file: "file.txt")
|
34
|
+
expect(a.file.present?).to be_falsey
|
35
|
+
|
36
|
+
a.file.reload
|
37
|
+
expect(a.file.present?).to be_truthy
|
38
|
+
expect(a.file.read).to eq "contents"
|
39
|
+
end
|
24
40
|
end
|
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.
|
4
|
+
version: 0.5.7
|
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-
|
11
|
+
date: 2018-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|