saviour 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,51 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Saviour do
4
- describe ".attached_files" do
5
- it "includes a mapping of the currently attached files and their versions" do
6
- uploader = Class.new(Saviour::BaseUploader) do
7
- store_dir { "/store/dir" }
8
-
9
- version(:thumb)
10
- version(:thumb_2)
11
- end
12
-
13
- klass = Class.new do
14
- include Saviour::BasicModel
15
- attach_file :file, uploader
16
- end
17
-
18
- expect(klass.attached_files).to eq({file: [:thumb, :thumb_2]})
19
-
20
- klass2 = Class.new do
21
- include Saviour::BasicModel
22
- attach_file :file, Saviour::BaseUploader
23
- end
24
-
25
- expect(klass2.attached_files).to eq({file: []})
26
- end
27
- end
28
-
29
- it "doens't mess with default File constant" do
30
- # Constant lookup in ruby works by lexical scope, so we can't create classes dynamically like above.
31
- expect(TestForSaviourFileResolution.new.foo).to be_falsey
32
- end
33
-
34
- it "shares model definitions with subclasses" do
35
- uploader = Class.new(Saviour::BaseUploader) do
36
- store_dir { "/store/dir" }
37
- version(:thumb)
38
- end
39
-
40
- klass = Class.new do
41
- include Saviour::BasicModel
42
- attach_file :file, uploader
43
- end
44
- expect(klass.attached_files).to eq({file: [:thumb]})
45
-
46
- klass2 = Class.new(klass)
47
- expect(klass2.attached_files).to eq({file: [:thumb]})
48
-
49
- expect(klass2.new.file).to respond_to :exists?
50
- end
51
- end