card 1.19.3 → 1.19.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/VERSION +1 -1
- data/card.gemspec +1 -3
- data/db/migrate_core_cards/20160914132636_fix_mod_files.rb +25 -0
- data/lib/card.rb +0 -2
- data/lib/card/content/diff.rb +3 -4
- data/lib/card/format/error.rb +1 -1
- data/mod/admin/set/self/admin.rb +2 -2
- data/mod/admin/set/self/trash.rb +9 -3
- data/mod/basic_types/set/type/html.rb +1 -1
- data/mod/bootstrap/set/all/bootstrap/layout.rb +58 -0
- data/mod/bootstrap/spec/set/all/bootstrap/layout_spec.rb +32 -0
- data/mod/carrierwave/lib/carrier_wave/cardmount.rb +0 -2
- data/mod/carrierwave/set/abstract/attachment/upload_cache.rb +2 -1
- data/mod/core/set/all/stages.rb +6 -4
- data/mod/history/lib/card/act.rb +8 -7
- data/mod/history/set/all/history.rb +10 -8
- data/mod/machines/set/abstract/script.rb +1 -1
- data/mod/machines/set/type/css.rb +1 -1
- data/mod/pointer/set/abstract/01_pointer.rb +1 -1
- data/mod/standard/file/credit_image/image-icon.png +0 -0
- data/mod/standard/file/credit_image/image-large.png +0 -0
- data/mod/standard/file/credit_image/image-medium.png +0 -0
- data/mod/standard/file/credit_image/image-small.png +0 -0
- data/mod/standard/file/favicon/image-icon.png +0 -0
- data/mod/standard/file/favicon/image-large.png +0 -0
- data/mod/standard/file/favicon/image-medium.png +0 -0
- data/mod/standard/file/favicon/image-small.png +0 -0
- data/mod/standard/file/logo/image-icon.png +0 -0
- data/mod/standard/file/logo/image-large.png +0 -0
- data/mod/standard/file/logo/image-medium.png +0 -0
- data/mod/standard/file/logo/image-small.png +0 -0
- data/mod/standard/set/self/recent.rb +2 -2
- data/spec/lib/card/diff_spec.rb +9 -9
- metadata +19 -156
- data/vendor/carrierwave/.gitignore +0 -19
- data/vendor/carrierwave/.rubocop.yml +0 -262
- data/vendor/carrierwave/.travis.yml +0 -58
- data/vendor/carrierwave/CHANGELOG.md +0 -81
- data/vendor/carrierwave/CONTRIBUTING.md +0 -37
- data/vendor/carrierwave/Gemfile +0 -5
- data/vendor/carrierwave/README.md +0 -995
- data/vendor/carrierwave/Rakefile +0 -26
- data/vendor/carrierwave/carrierwave.gemspec +0 -45
- data/vendor/carrierwave/cucumber.yml +0 -2
- data/vendor/carrierwave/features/caching.feature +0 -28
- data/vendor/carrierwave/features/download.feature +0 -20
- data/vendor/carrierwave/features/file_storage.feature +0 -37
- data/vendor/carrierwave/features/file_storage_overridden_filename.feature +0 -38
- data/vendor/carrierwave/features/file_storage_overridden_store_dir.feature +0 -38
- data/vendor/carrierwave/features/file_storage_reversing_processor.feature +0 -43
- data/vendor/carrierwave/features/fixtures/bork.txt +0 -1
- data/vendor/carrierwave/features/fixtures/monkey.txt +0 -1
- data/vendor/carrierwave/features/fixtures/upcased_bork.txt +0 -1
- data/vendor/carrierwave/features/mount_activerecord.feature +0 -46
- data/vendor/carrierwave/features/step_definitions/activerecord_steps.rb +0 -20
- data/vendor/carrierwave/features/step_definitions/caching_steps.rb +0 -12
- data/vendor/carrierwave/features/step_definitions/datamapper_steps.rb +0 -27
- data/vendor/carrierwave/features/step_definitions/download_steps.rb +0 -8
- data/vendor/carrierwave/features/step_definitions/file_steps.rb +0 -51
- data/vendor/carrierwave/features/step_definitions/general_steps.rb +0 -102
- data/vendor/carrierwave/features/step_definitions/mount_steps.rb +0 -17
- data/vendor/carrierwave/features/step_definitions/store_steps.rb +0 -16
- data/vendor/carrierwave/features/support/activerecord.rb +0 -18
- data/vendor/carrierwave/features/support/env.rb +0 -19
- data/vendor/carrierwave/features/versions_basics.feature +0 -50
- data/vendor/carrierwave/features/versions_caching_from_versions.feature +0 -32
- data/vendor/carrierwave/features/versions_nested_versions.feature +0 -70
- data/vendor/carrierwave/features/versions_overridden_filename.feature +0 -51
- data/vendor/carrierwave/features/versions_overriden_store_dir.feature +0 -41
- data/vendor/carrierwave/gemfiles/rails-4-0-stable.gemfile +0 -5
- data/vendor/carrierwave/gemfiles/rails-4-1-stable.gemfile +0 -5
- data/vendor/carrierwave/gemfiles/rails-4-2-stable.gemfile +0 -5
- data/vendor/carrierwave/gemfiles/rails-master.gemfile +0 -11
- data/vendor/carrierwave/lib/carrierwave.rb +0 -93
- data/vendor/carrierwave/lib/carrierwave/compatibility/paperclip.rb +0 -103
- data/vendor/carrierwave/lib/carrierwave/error.rb +0 -8
- data/vendor/carrierwave/lib/carrierwave/locale/cs.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/de.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/el.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/en.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/es.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/fr-CA.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/fr.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/id.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/ja.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/nb.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/nl.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/pl.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/pt-BR.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/pt-PT.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/ru.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/sk.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/tr.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/zh-CN.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/locale/zh-TW.yml +0 -14
- data/vendor/carrierwave/lib/carrierwave/mount.rb +0 -444
- data/vendor/carrierwave/lib/carrierwave/mounter.rb +0 -163
- data/vendor/carrierwave/lib/carrierwave/orm/activerecord.rb +0 -103
- data/vendor/carrierwave/lib/carrierwave/processing.rb +0 -2
- data/vendor/carrierwave/lib/carrierwave/processing/mini_magick.rb +0 -328
- data/vendor/carrierwave/lib/carrierwave/processing/rmagick.rb +0 -379
- data/vendor/carrierwave/lib/carrierwave/sanitized_file.rb +0 -348
- data/vendor/carrierwave/lib/carrierwave/storage.rb +0 -2
- data/vendor/carrierwave/lib/carrierwave/storage/abstract.rb +0 -43
- data/vendor/carrierwave/lib/carrierwave/storage/file.rb +0 -118
- data/vendor/carrierwave/lib/carrierwave/storage/fog.rb +0 -462
- data/vendor/carrierwave/lib/carrierwave/test/matchers.rb +0 -394
- data/vendor/carrierwave/lib/carrierwave/uploader.rb +0 -67
- data/vendor/carrierwave/lib/carrierwave/uploader/cache.rb +0 -207
- data/vendor/carrierwave/lib/carrierwave/uploader/callbacks.rb +0 -33
- data/vendor/carrierwave/lib/carrierwave/uploader/configuration.rb +0 -203
- data/vendor/carrierwave/lib/carrierwave/uploader/content_type_blacklist.rb +0 -48
- data/vendor/carrierwave/lib/carrierwave/uploader/content_type_whitelist.rb +0 -48
- data/vendor/carrierwave/lib/carrierwave/uploader/default_url.rb +0 -17
- data/vendor/carrierwave/lib/carrierwave/uploader/download.rb +0 -92
- data/vendor/carrierwave/lib/carrierwave/uploader/extension_blacklist.rb +0 -51
- data/vendor/carrierwave/lib/carrierwave/uploader/extension_whitelist.rb +0 -51
- data/vendor/carrierwave/lib/carrierwave/uploader/file_size.rb +0 -41
- data/vendor/carrierwave/lib/carrierwave/uploader/magic_mime_blacklist.rb +0 -94
- data/vendor/carrierwave/lib/carrierwave/uploader/magic_mime_whitelist.rb +0 -94
- data/vendor/carrierwave/lib/carrierwave/uploader/mountable.rb +0 -38
- data/vendor/carrierwave/lib/carrierwave/uploader/processing.rb +0 -88
- data/vendor/carrierwave/lib/carrierwave/uploader/proxy.rb +0 -86
- data/vendor/carrierwave/lib/carrierwave/uploader/remove.rb +0 -21
- data/vendor/carrierwave/lib/carrierwave/uploader/serialization.rb +0 -28
- data/vendor/carrierwave/lib/carrierwave/uploader/store.rb +0 -93
- data/vendor/carrierwave/lib/carrierwave/uploader/url.rb +0 -41
- data/vendor/carrierwave/lib/carrierwave/uploader/versions.rb +0 -295
- data/vendor/carrierwave/lib/carrierwave/utilities.rb +0 -6
- data/vendor/carrierwave/lib/carrierwave/utilities/uri.rb +0 -21
- data/vendor/carrierwave/lib/carrierwave/validations/active_model.rb +0 -78
- data/vendor/carrierwave/lib/carrierwave/version.rb +0 -3
- data/vendor/carrierwave/lib/generators/templates/uploader.rb +0 -49
- data/vendor/carrierwave/lib/generators/uploader_generator.rb +0 -7
- data/vendor/carrierwave/script/console +0 -10
- data/vendor/carrierwave/script/destroy +0 -14
- data/vendor/carrierwave/script/generate +0 -14
- data/vendor/carrierwave/spec/compatibility/paperclip_spec.rb +0 -138
- data/vendor/carrierwave/spec/fixtures/Uppercase.jpg +0 -1
- data/vendor/carrierwave/spec/fixtures/bork.ttxt +0 -1
- data/vendor/carrierwave/spec/fixtures/bork.txt +0 -1
- data/vendor/carrierwave/spec/fixtures/bork.txtt +0 -1
- data/vendor/carrierwave/spec/fixtures/case.JPG +0 -1
- data/vendor/carrierwave/spec/fixtures/landscape.jpg +0 -0
- data/vendor/carrierwave/spec/fixtures/multi_page.pdf +0 -0
- data/vendor/carrierwave/spec/fixtures/new.jpeg +0 -1
- data/vendor/carrierwave/spec/fixtures/new.txt +0 -1
- data/vendor/carrierwave/spec/fixtures/old.jpeg +0 -1
- data/vendor/carrierwave/spec/fixtures/old.txt +0 -1
- data/vendor/carrierwave/spec/fixtures/portrait.jpg +0 -0
- data/vendor/carrierwave/spec/fixtures/ruby.gif +0 -0
- data/vendor/carrierwave/spec/fixtures/sponsored.doc +0 -1
- data/vendor/carrierwave/spec/fixtures/test+.jpg +0 -1
- data/vendor/carrierwave/spec/fixtures/test.jpeg +0 -1
- data/vendor/carrierwave/spec/fixtures/test.jpg +0 -1
- data/vendor/carrierwave/spec/generators/uploader_generator_spec.rb +0 -19
- data/vendor/carrierwave/spec/mount_multiple_spec.rb +0 -913
- data/vendor/carrierwave/spec/mount_single_spec.rb +0 -793
- data/vendor/carrierwave/spec/orm/activerecord_spec.rb +0 -1556
- data/vendor/carrierwave/spec/processing/mini_magick_spec.rb +0 -210
- data/vendor/carrierwave/spec/processing/rmagick_spec.rb +0 -250
- data/vendor/carrierwave/spec/sanitized_file_spec.rb +0 -805
- data/vendor/carrierwave/spec/spec_helper.rb +0 -105
- data/vendor/carrierwave/spec/storage/file_spec.rb +0 -82
- data/vendor/carrierwave/spec/storage/fog_credentials.rb +0 -46
- data/vendor/carrierwave/spec/storage/fog_helper.rb +0 -428
- data/vendor/carrierwave/spec/storage/fog_spec.rb +0 -48
- data/vendor/carrierwave/spec/support/activerecord.rb +0 -31
- data/vendor/carrierwave/spec/support/file_utils_helper.rb +0 -15
- data/vendor/carrierwave/spec/uploader/cache_spec.rb +0 -324
- data/vendor/carrierwave/spec/uploader/callback_spec.rb +0 -30
- data/vendor/carrierwave/spec/uploader/configuration_spec.rb +0 -133
- data/vendor/carrierwave/spec/uploader/content_type_blacklist_spec.rb +0 -61
- data/vendor/carrierwave/spec/uploader/content_type_whitelist_spec.rb +0 -63
- data/vendor/carrierwave/spec/uploader/default_url_spec.rb +0 -77
- data/vendor/carrierwave/spec/uploader/download_spec.rb +0 -204
- data/vendor/carrierwave/spec/uploader/extension_blacklist_spec.rb +0 -112
- data/vendor/carrierwave/spec/uploader/extension_whitelist_spec.rb +0 -102
- data/vendor/carrierwave/spec/uploader/file_size_spec.rb +0 -52
- data/vendor/carrierwave/spec/uploader/mountable_spec.rb +0 -26
- data/vendor/carrierwave/spec/uploader/overrides_spec.rb +0 -71
- data/vendor/carrierwave/spec/uploader/paths_spec.rb +0 -18
- data/vendor/carrierwave/spec/uploader/processing_spec.rb +0 -159
- data/vendor/carrierwave/spec/uploader/proxy_spec.rb +0 -79
- data/vendor/carrierwave/spec/uploader/remove_spec.rb +0 -71
- data/vendor/carrierwave/spec/uploader/store_spec.rb +0 -400
- data/vendor/carrierwave/spec/uploader/url_spec.rb +0 -273
- data/vendor/carrierwave/spec/uploader/versions_spec.rb +0 -633
@@ -1,805 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
begin
|
4
|
-
# Use mime/types/columnar if available, for reduced memory usage
|
5
|
-
require 'mime/types/columnar'
|
6
|
-
rescue LoadError
|
7
|
-
require 'mime/types'
|
8
|
-
end
|
9
|
-
|
10
|
-
describe CarrierWave::SanitizedFile do
|
11
|
-
before do
|
12
|
-
FileUtils.cp(file_path('test.jpg'), file_path('llama.jpg'))
|
13
|
-
end
|
14
|
-
|
15
|
-
after(:all) do
|
16
|
-
if File.exist?(file_path('llama.jpg'))
|
17
|
-
FileUtils.rm(file_path('llama.jpg'))
|
18
|
-
end
|
19
|
-
FileUtils.rm_rf(public_path)
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "#empty?" do
|
23
|
-
it "should be empty for nil" do
|
24
|
-
sanitized_file = CarrierWave::SanitizedFile.new(nil)
|
25
|
-
|
26
|
-
expect(sanitized_file).to be_empty
|
27
|
-
end
|
28
|
-
|
29
|
-
it "should be empty for an empty string" do
|
30
|
-
sanitized_file = CarrierWave::SanitizedFile.new("")
|
31
|
-
|
32
|
-
expect(sanitized_file).to be_empty
|
33
|
-
end
|
34
|
-
|
35
|
-
it "should be empty for an empty StringIO" do
|
36
|
-
sanitized_file = CarrierWave::SanitizedFile.new(StringIO.new(""))
|
37
|
-
|
38
|
-
expect(sanitized_file).to be_empty
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
describe '#original_filename' do
|
44
|
-
it "should default to the original_filename" do
|
45
|
-
file = double('file', :original_filename => 'llama.jpg')
|
46
|
-
sanitized_file = CarrierWave::SanitizedFile.new(file)
|
47
|
-
expect(sanitized_file.original_filename).to eq("llama.jpg")
|
48
|
-
end
|
49
|
-
|
50
|
-
it "should defer to the base name of the path if original_filename is unavailable" do
|
51
|
-
file = double('file', :path => '/path/to/test.jpg')
|
52
|
-
sanitized_file = CarrierWave::SanitizedFile.new(file)
|
53
|
-
expect(sanitized_file.original_filename).to eq("test.jpg")
|
54
|
-
end
|
55
|
-
|
56
|
-
it "should be nil otherwise" do
|
57
|
-
file = double('file')
|
58
|
-
sanitized_file = CarrierWave::SanitizedFile.new(file)
|
59
|
-
expect(sanitized_file.original_filename).to be_nil
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe "#basename" do
|
64
|
-
it "should return the basename for complicated extensions" do
|
65
|
-
sanitized_file = CarrierWave::SanitizedFile.new(file_path("complex.filename.tar.gz"))
|
66
|
-
|
67
|
-
expect(sanitized_file.basename).to eq("complex.filename")
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should be the filename if the file has no extension" do
|
71
|
-
sanitized_file = CarrierWave::SanitizedFile.new(file_path("complex"))
|
72
|
-
|
73
|
-
expect(sanitized_file.basename).to eq("complex")
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe "#extension" do
|
78
|
-
%w[gz bz2 z lz xz].each do |ext|
|
79
|
-
it "should return the extension for complicated extensions (tar.#{ext})" do
|
80
|
-
sanitized_file = CarrierWave::SanitizedFile.new(file_path("complex.filename.tar.#{ext}"))
|
81
|
-
|
82
|
-
expect(sanitized_file.extension).to eq("tar.#{ext}")
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should return the extension for real-world user file names" do
|
87
|
-
sanitized_file = CarrierWave::SanitizedFile.new(file_path("Photo on 2009-12-01 at 11.12.jpg"))
|
88
|
-
|
89
|
-
expect(sanitized_file.extension).to eq("jpg")
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should return the extension for basic filenames" do
|
93
|
-
sanitized_file = CarrierWave::SanitizedFile.new(file_path("something.png"))
|
94
|
-
|
95
|
-
expect(sanitized_file.extension).to eq("png")
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should be an empty string if the file has no extension" do
|
99
|
-
sanitized_file = CarrierWave::SanitizedFile.new(file_path("complex"))
|
100
|
-
|
101
|
-
expect(sanitized_file.extension).to eq("")
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
describe "#filename" do
|
106
|
-
let(:sanitized_file) { CarrierWave::SanitizedFile.new(nil) }
|
107
|
-
|
108
|
-
it "should default to the original filename if it is valid" do
|
109
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return("llama.jpg")
|
110
|
-
expect(sanitized_file.filename).to eq("llama.jpg")
|
111
|
-
end
|
112
|
-
|
113
|
-
it "should remove illegal characters from a filename" do
|
114
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return("test-s,%&m#st?.jpg")
|
115
|
-
expect(sanitized_file.filename).to eq("test-s___m_st_.jpg")
|
116
|
-
end
|
117
|
-
|
118
|
-
it "should remove slashes from the filename" do
|
119
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return("../../very_tricky/foo.bar")
|
120
|
-
expect(sanitized_file.filename).not_to match(/[\\\/]/)
|
121
|
-
end
|
122
|
-
|
123
|
-
it "should remove illegal characters if there is no extension" do
|
124
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return("`*foo")
|
125
|
-
expect(sanitized_file.filename).to eq("__foo")
|
126
|
-
end
|
127
|
-
|
128
|
-
it "should remove the path prefix on Windows" do
|
129
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return('c:\temp\foo.txt')
|
130
|
-
expect(sanitized_file.filename).to eq("foo.txt")
|
131
|
-
end
|
132
|
-
|
133
|
-
it "should make sure the *nix directory thingies can't be used as filenames" do
|
134
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return(".")
|
135
|
-
expect(sanitized_file.filename).to eq("_.")
|
136
|
-
end
|
137
|
-
|
138
|
-
it "should maintain uppercase filenames" do
|
139
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return("DSC4056.JPG")
|
140
|
-
expect(sanitized_file.filename).to eq("DSC4056.JPG")
|
141
|
-
end
|
142
|
-
|
143
|
-
it "should remove illegal characters from a non-ASCII filename" do
|
144
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return("⟲«Du côté des chars lourds»_123.doc")
|
145
|
-
expect(sanitized_file.filename).to eq("__Du_côté_des_chars_lourds__123.doc")
|
146
|
-
end
|
147
|
-
|
148
|
-
it "should default to the original non-ASCII filename if it is valid" do
|
149
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return("тестовый.jpg")
|
150
|
-
expect(sanitized_file.filename).to eq("тестовый.jpg")
|
151
|
-
end
|
152
|
-
|
153
|
-
it "should downcase non-ASCII characters properly" do
|
154
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return("ТестоВый Ёжик.jpg")
|
155
|
-
expect(sanitized_file.filename).to eq("ТестоВый_Ёжик.jpg")
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
describe "#filename with an overridden sanitize_regexp" do
|
160
|
-
let(:sanitized_file) { CarrierWave::SanitizedFile.new(nil) }
|
161
|
-
|
162
|
-
before do
|
163
|
-
allow(sanitized_file).to receive(:sanitize_regexp).and_return(/[^a-zA-Z\.\-\+_]/)
|
164
|
-
end
|
165
|
-
|
166
|
-
it "should default to the original filename if it is valid" do
|
167
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return("llama.jpg")
|
168
|
-
expect(sanitized_file.filename).to eq("llama.jpg")
|
169
|
-
end
|
170
|
-
|
171
|
-
it "should remove illegal characters from a filename" do
|
172
|
-
expect(sanitized_file).to receive(:original_filename).at_least(:once).and_return("123.jpg")
|
173
|
-
expect(sanitized_file.filename).to eq("___.jpg")
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
describe "#content_type" do
|
178
|
-
it "preserves file's content_type" do
|
179
|
-
sanitized_file = CarrierWave::SanitizedFile.new(content_type: "image/png")
|
180
|
-
|
181
|
-
expect(sanitized_file.content_type).to eq("image/png")
|
182
|
-
end
|
183
|
-
|
184
|
-
it "preserves file's content_type when passed as type (Rack)" do
|
185
|
-
sanitized_file = CarrierWave::SanitizedFile.new(type: "image/png")
|
186
|
-
|
187
|
-
expect(sanitized_file.content_type).to eq("image/png")
|
188
|
-
end
|
189
|
-
|
190
|
-
it "handles Mime::Type object" do
|
191
|
-
file = File.open(file_path('sponsored.doc'))
|
192
|
-
allow(file).to receive(:content_type).and_return(MIME::Type.new("application/msword"))
|
193
|
-
sanitized_file = CarrierWave::SanitizedFile.new(file)
|
194
|
-
allow(sanitized_file).to receive(:file).and_return(file)
|
195
|
-
|
196
|
-
expect { sanitized_file.content_type }.not_to raise_error
|
197
|
-
expect(sanitized_file.content_type).to eq("application/msword")
|
198
|
-
end
|
199
|
-
|
200
|
-
it "reads content type from path if missing" do
|
201
|
-
sanitized_file = CarrierWave::SanitizedFile.new("llama.jpg")
|
202
|
-
|
203
|
-
expect(sanitized_file.content_type).to eq("image/jpeg")
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
describe "#content_type=" do
|
208
|
-
it "sets content_type" do
|
209
|
-
sanitized_file = CarrierWave::SanitizedFile.new(content_type: "image/png")
|
210
|
-
sanitized_file.content_type = "text/html"
|
211
|
-
|
212
|
-
expect(sanitized_file.content_type).to eq("text/html")
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
shared_examples_for "all valid sanitized files" do
|
217
|
-
describe '#empty?' do
|
218
|
-
it "should not be empty" do
|
219
|
-
expect(sanitized_file).not_to be_empty
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
describe '#original_filename' do
|
224
|
-
it "should return the original filename" do
|
225
|
-
expect(sanitized_file.original_filename).to eq("llama.jpg")
|
226
|
-
end
|
227
|
-
end
|
228
|
-
|
229
|
-
describe "#filename" do
|
230
|
-
it "should return the filename" do
|
231
|
-
expect(sanitized_file.filename).to eq("llama.jpg")
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
describe "#basename" do
|
236
|
-
it "should return the basename" do
|
237
|
-
expect(sanitized_file.basename).to eq("llama")
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
describe "#extension" do
|
242
|
-
it "should return the extension" do
|
243
|
-
expect(sanitized_file.extension).to eq("jpg")
|
244
|
-
end
|
245
|
-
end
|
246
|
-
|
247
|
-
describe "#read" do
|
248
|
-
it "should return the contents of the file" do
|
249
|
-
expect(sanitized_file.read).to eq("this is stuff")
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
describe "#size" do
|
254
|
-
it "should return the size of the file" do
|
255
|
-
expect(sanitized_file.size).to eq(13)
|
256
|
-
end
|
257
|
-
end
|
258
|
-
|
259
|
-
describe "#move_to" do
|
260
|
-
after do
|
261
|
-
FileUtils.rm_f(file_path("gurr.png"))
|
262
|
-
end
|
263
|
-
|
264
|
-
it "should be moved to the correct location" do
|
265
|
-
sanitized_file.move_to(file_path("gurr.png"))
|
266
|
-
|
267
|
-
expect(File.exist?( file_path("gurr.png") )).to be_truthy
|
268
|
-
end
|
269
|
-
|
270
|
-
it "should have changed its path when moved" do
|
271
|
-
sanitized_file.move_to(file_path("gurr.png"))
|
272
|
-
|
273
|
-
expect(sanitized_file.path).to eq(file_path("gurr.png"))
|
274
|
-
end
|
275
|
-
|
276
|
-
it "should have changed its filename when moved" do
|
277
|
-
sanitized_file.move_to(file_path("gurr.png"))
|
278
|
-
|
279
|
-
expect(sanitized_file.filename).to eq("gurr.png")
|
280
|
-
end
|
281
|
-
|
282
|
-
it "should have changed its basename when moved" do
|
283
|
-
sanitized_file.move_to(file_path("gurr.png"))
|
284
|
-
|
285
|
-
expect(sanitized_file.basename).to eq("gurr")
|
286
|
-
end
|
287
|
-
|
288
|
-
it "should have changed its extension when moved" do
|
289
|
-
sanitized_file.move_to(file_path("gurr.png"))
|
290
|
-
|
291
|
-
expect(sanitized_file.extension).to eq("png")
|
292
|
-
end
|
293
|
-
|
294
|
-
it "should set the right permissions" do
|
295
|
-
sanitized_file.move_to(file_path("gurr.png"), 0755)
|
296
|
-
|
297
|
-
expect(sanitized_file).to have_permissions(0755)
|
298
|
-
end
|
299
|
-
|
300
|
-
it "should set the right directory permissions" do
|
301
|
-
sanitized_file.move_to(file_path("new_dir","gurr.png"), nil, 0775)
|
302
|
-
|
303
|
-
expect(sanitized_file).to have_directory_permissions(0775)
|
304
|
-
FileUtils.rm_rf(file_path("new_dir"))
|
305
|
-
end
|
306
|
-
|
307
|
-
it "should return itself" do
|
308
|
-
expect(sanitized_file.move_to(file_path("gurr.png"))).to eq(sanitized_file)
|
309
|
-
end
|
310
|
-
end
|
311
|
-
|
312
|
-
describe "#copy_to" do
|
313
|
-
after do
|
314
|
-
FileUtils.rm_f(file_path("gurr.png"))
|
315
|
-
end
|
316
|
-
|
317
|
-
it "should be copied to the correct location" do
|
318
|
-
sanitized_file.copy_to(file_path("gurr.png"))
|
319
|
-
|
320
|
-
expect(File.exist?( file_path("gurr.png") )).to be_truthy
|
321
|
-
|
322
|
-
expect(file_path("gurr.png")).to be_identical_to(file_path("llama.jpg"))
|
323
|
-
end
|
324
|
-
|
325
|
-
it "should not have changed its path when copied" do
|
326
|
-
expect(running { sanitized_file.copy_to(file_path("gurr.png")) }).not_to change(sanitized_file, :path)
|
327
|
-
end
|
328
|
-
|
329
|
-
it "should not have changed its filename when copied" do
|
330
|
-
expect(running { sanitized_file.copy_to(file_path("gurr.png")) }).not_to change(sanitized_file, :filename)
|
331
|
-
end
|
332
|
-
|
333
|
-
it "should return an object of the same class when copied" do
|
334
|
-
new_file = sanitized_file.copy_to(file_path("gurr.png"))
|
335
|
-
|
336
|
-
expect(new_file).to be_an_instance_of(sanitized_file.class)
|
337
|
-
end
|
338
|
-
|
339
|
-
it "should adjust the path of the object that is returned when copied" do
|
340
|
-
new_file = sanitized_file.copy_to(file_path("gurr.png"))
|
341
|
-
|
342
|
-
expect(new_file.path).to eq(file_path("gurr.png"))
|
343
|
-
end
|
344
|
-
|
345
|
-
it "should adjust the filename of the object that is returned when copied" do
|
346
|
-
new_file = sanitized_file.copy_to(file_path("gurr.png"))
|
347
|
-
|
348
|
-
expect(new_file.filename).to eq("gurr.png")
|
349
|
-
end
|
350
|
-
|
351
|
-
it "should adjust the basename of the object that is returned when copied" do
|
352
|
-
new_file = sanitized_file.copy_to(file_path("gurr.png"))
|
353
|
-
|
354
|
-
expect(new_file.basename).to eq("gurr")
|
355
|
-
end
|
356
|
-
|
357
|
-
it "should adjust the extension of the object that is returned when copied" do
|
358
|
-
new_file = sanitized_file.copy_to(file_path("gurr.png"))
|
359
|
-
|
360
|
-
expect(new_file.extension).to eq("png")
|
361
|
-
end
|
362
|
-
|
363
|
-
it "should set the right permissions" do
|
364
|
-
new_file = sanitized_file.copy_to(file_path("gurr.png"), 0755)
|
365
|
-
|
366
|
-
expect(new_file).to have_permissions(0755)
|
367
|
-
end
|
368
|
-
|
369
|
-
it "should set the right directory permissions" do
|
370
|
-
new_file = sanitized_file.copy_to(file_path("new_dir", "gurr.png"), nil, 0755)
|
371
|
-
|
372
|
-
expect(new_file).to have_directory_permissions(0755)
|
373
|
-
FileUtils.rm_rf(file_path("new_dir"))
|
374
|
-
end
|
375
|
-
|
376
|
-
it "should preserve the file's content type" do
|
377
|
-
new_file = sanitized_file.copy_to(file_path("gurr.png"))
|
378
|
-
|
379
|
-
expect(new_file.content_type).to eq(sanitized_file.content_type)
|
380
|
-
end
|
381
|
-
end
|
382
|
-
end
|
383
|
-
|
384
|
-
shared_examples_for "all valid sanitized files that are stored on disk" do
|
385
|
-
describe "#move_to" do
|
386
|
-
it "should not raise an error when moved to its own location" do
|
387
|
-
expect(running { sanitized_file.move_to(sanitized_file.path) }).not_to raise_error
|
388
|
-
end
|
389
|
-
|
390
|
-
it "should remove the original file" do
|
391
|
-
original_path = sanitized_file.path
|
392
|
-
sanitized_file.move_to(public_path("blah.txt"))
|
393
|
-
|
394
|
-
expect(File.exist?(original_path)).to be_falsey
|
395
|
-
end
|
396
|
-
end
|
397
|
-
|
398
|
-
describe '#copy_to' do
|
399
|
-
it "should return a new instance when copied to its own location" do
|
400
|
-
expect(running {
|
401
|
-
new_file = sanitized_file.copy_to(sanitized_file.path)
|
402
|
-
expect(new_file).to be_an_instance_of(sanitized_file.class)
|
403
|
-
}).not_to raise_error
|
404
|
-
end
|
405
|
-
|
406
|
-
it "should not remove the original file" do
|
407
|
-
new_file = sanitized_file.copy_to(public_path("blah.txt"))
|
408
|
-
|
409
|
-
expect(File.exist?(sanitized_file.path)).to be_truthy
|
410
|
-
expect(File.exist?(new_file.path)).to be_truthy
|
411
|
-
end
|
412
|
-
end
|
413
|
-
|
414
|
-
describe "#exists?" do
|
415
|
-
it "should be true" do
|
416
|
-
expect(sanitized_file.exists?).to be_truthy
|
417
|
-
end
|
418
|
-
end
|
419
|
-
|
420
|
-
describe "#delete" do
|
421
|
-
it "should remove it from the filesystem" do
|
422
|
-
expect(File.exist?(sanitized_file.path)).to be_truthy
|
423
|
-
|
424
|
-
sanitized_file.delete
|
425
|
-
|
426
|
-
expect(File.exist?(sanitized_file.path)).to be_falsey
|
427
|
-
end
|
428
|
-
end
|
429
|
-
|
430
|
-
describe "#to_file" do
|
431
|
-
it "should return a File object" do
|
432
|
-
expect(sanitized_file.to_file).to be_a(File)
|
433
|
-
end
|
434
|
-
|
435
|
-
it "should have the same path as the SanitizedFile" do
|
436
|
-
expect(sanitized_file.to_file.path).to eq(sanitized_file.path)
|
437
|
-
end
|
438
|
-
|
439
|
-
it "should have the same contents as the SantizedFile" do
|
440
|
-
expect(sanitized_file.to_file.read).to eq(sanitized_file.read)
|
441
|
-
end
|
442
|
-
end
|
443
|
-
end
|
444
|
-
|
445
|
-
shared_examples_for "all valid sanitized files that are read from an IO object" do
|
446
|
-
|
447
|
-
describe "#read" do
|
448
|
-
it "should have an open IO object" do
|
449
|
-
expect(sanitized_file.instance_variable_get(:@file).closed?).to be_falsey
|
450
|
-
end
|
451
|
-
|
452
|
-
it "should close the IO object after reading" do
|
453
|
-
sanitized_file.read
|
454
|
-
|
455
|
-
expect(sanitized_file.instance_variable_get(:@file).closed?).to be_truthy
|
456
|
-
end
|
457
|
-
end
|
458
|
-
end
|
459
|
-
|
460
|
-
describe "with a valid Hash" do
|
461
|
-
let(:hash) {
|
462
|
-
{
|
463
|
-
"tempfile" => stub_merb_tempfile("llama.jpg"),
|
464
|
-
"filename" => "llama.jpg",
|
465
|
-
"content_type" => "image/jpeg"
|
466
|
-
}
|
467
|
-
}
|
468
|
-
let(:sanitized_file) { CarrierWave::SanitizedFile.new(hash) }
|
469
|
-
|
470
|
-
it_should_behave_like "all valid sanitized files"
|
471
|
-
|
472
|
-
it_should_behave_like "all valid sanitized files that are stored on disk"
|
473
|
-
|
474
|
-
it_should_behave_like "all valid sanitized files that are read from an IO object"
|
475
|
-
|
476
|
-
describe "#path" do
|
477
|
-
it "should return the path of the tempfile" do
|
478
|
-
expect(sanitized_file.path).not_to be_nil
|
479
|
-
expect(sanitized_file.path).to eq(hash["tempfile"].path)
|
480
|
-
end
|
481
|
-
end
|
482
|
-
|
483
|
-
describe "#is_path?" do
|
484
|
-
it "should be false" do
|
485
|
-
expect(sanitized_file.is_path?).to be_falsey
|
486
|
-
end
|
487
|
-
end
|
488
|
-
end
|
489
|
-
|
490
|
-
describe "with a valid Tempfile" do
|
491
|
-
let(:tempfile) { stub_tempfile("llama.jpg", "image/jpeg") }
|
492
|
-
let(:sanitized_file) { CarrierWave::SanitizedFile.new(tempfile) }
|
493
|
-
|
494
|
-
it_should_behave_like "all valid sanitized files"
|
495
|
-
|
496
|
-
it_should_behave_like "all valid sanitized files that are stored on disk"
|
497
|
-
|
498
|
-
it_should_behave_like "all valid sanitized files that are read from an IO object"
|
499
|
-
|
500
|
-
describe "#is_path?" do
|
501
|
-
it "should be false" do
|
502
|
-
expect(sanitized_file.is_path?).to be_falsey
|
503
|
-
end
|
504
|
-
end
|
505
|
-
|
506
|
-
describe "#path" do
|
507
|
-
it "should return the path of the tempfile" do
|
508
|
-
expect(sanitized_file.path).not_to be_nil
|
509
|
-
expect(sanitized_file.path).to eq(tempfile.path)
|
510
|
-
end
|
511
|
-
end
|
512
|
-
end
|
513
|
-
|
514
|
-
describe "with a valid StringIO" do
|
515
|
-
let(:sanitized_file) { CarrierWave::SanitizedFile.new(stub_stringio("llama.jpg", "image/jpeg")) }
|
516
|
-
|
517
|
-
it_should_behave_like "all valid sanitized files"
|
518
|
-
|
519
|
-
it_should_behave_like "all valid sanitized files that are read from an IO object"
|
520
|
-
|
521
|
-
describe "#exists?" do
|
522
|
-
it "should be false" do
|
523
|
-
expect(sanitized_file.exists?).to be_falsey
|
524
|
-
end
|
525
|
-
end
|
526
|
-
|
527
|
-
describe "#is_path?" do
|
528
|
-
it "should be false" do
|
529
|
-
expect(sanitized_file.is_path?).to be_falsey
|
530
|
-
end
|
531
|
-
end
|
532
|
-
|
533
|
-
describe "#path" do
|
534
|
-
it "should be nil" do
|
535
|
-
expect(sanitized_file.path).to be_nil
|
536
|
-
end
|
537
|
-
end
|
538
|
-
|
539
|
-
describe "#delete" do
|
540
|
-
it "should not raise an error" do
|
541
|
-
expect(running { sanitized_file.delete }).not_to raise_error
|
542
|
-
end
|
543
|
-
end
|
544
|
-
|
545
|
-
describe "#to_file" do
|
546
|
-
it "should be nil" do
|
547
|
-
expect(sanitized_file.to_file).to be_nil
|
548
|
-
end
|
549
|
-
end
|
550
|
-
end
|
551
|
-
|
552
|
-
describe "with a valid File object" do
|
553
|
-
let(:sanitized_file) { CarrierWave::SanitizedFile.new(stub_file("llama.jpg", "image/jpeg")) }
|
554
|
-
|
555
|
-
before do
|
556
|
-
FileUtils.cp(file_path("test.jpg"), file_path("llama.jpg"))
|
557
|
-
|
558
|
-
expect(sanitized_file).not_to be_empty
|
559
|
-
end
|
560
|
-
|
561
|
-
it_should_behave_like "all valid sanitized files"
|
562
|
-
|
563
|
-
it_should_behave_like "all valid sanitized files that are stored on disk"
|
564
|
-
|
565
|
-
it_should_behave_like "all valid sanitized files that are read from an IO object"
|
566
|
-
|
567
|
-
describe "#is_path?" do
|
568
|
-
it "should be false" do
|
569
|
-
expect(sanitized_file.is_path?).to be_falsey
|
570
|
-
end
|
571
|
-
end
|
572
|
-
|
573
|
-
describe "#path" do
|
574
|
-
it "should return the path of the file" do
|
575
|
-
expect(sanitized_file.path).not_to be_nil
|
576
|
-
expect(sanitized_file.path).to eq(file_path("llama.jpg"))
|
577
|
-
end
|
578
|
-
end
|
579
|
-
end
|
580
|
-
|
581
|
-
describe "with a valid File object and an empty file" do
|
582
|
-
let(:sanitized_file) { CarrierWave::SanitizedFile.new(stub_file("llama.jpg", "image/jpeg")) }
|
583
|
-
|
584
|
-
before do
|
585
|
-
FileUtils.cp(file_path("test.jpg"), file_path("llama.jpg"))
|
586
|
-
FileUtils.rm file_path("llama.jpg")
|
587
|
-
FileUtils.touch file_path("llama.jpg")
|
588
|
-
|
589
|
-
expect(sanitized_file).not_to be_empty
|
590
|
-
end
|
591
|
-
|
592
|
-
it_should_behave_like "all valid sanitized files that are stored on disk"
|
593
|
-
|
594
|
-
it_should_behave_like "all valid sanitized files that are read from an IO object"
|
595
|
-
|
596
|
-
describe "#is_path?" do
|
597
|
-
it "should be false" do
|
598
|
-
expect(sanitized_file.is_path?).to be_falsey
|
599
|
-
end
|
600
|
-
end
|
601
|
-
|
602
|
-
describe "#path" do
|
603
|
-
it "should return the path of the file" do
|
604
|
-
expect(sanitized_file.path).not_to be_nil
|
605
|
-
expect(sanitized_file.path).to eq(file_path("llama.jpg"))
|
606
|
-
end
|
607
|
-
end
|
608
|
-
end
|
609
|
-
|
610
|
-
describe "with a valid path" do
|
611
|
-
let(:sanitized_file) { CarrierWave::SanitizedFile.new(file_path("llama.jpg")) }
|
612
|
-
|
613
|
-
before do
|
614
|
-
FileUtils.cp(file_path("test.jpg"), file_path("llama.jpg"))
|
615
|
-
|
616
|
-
expect(sanitized_file).not_to be_empty
|
617
|
-
end
|
618
|
-
|
619
|
-
it_should_behave_like "all valid sanitized files"
|
620
|
-
|
621
|
-
it_should_behave_like "all valid sanitized files that are stored on disk"
|
622
|
-
|
623
|
-
describe "#is_path?" do
|
624
|
-
it "should be true" do
|
625
|
-
expect(sanitized_file.is_path?).to be_truthy
|
626
|
-
end
|
627
|
-
end
|
628
|
-
|
629
|
-
describe "#path" do
|
630
|
-
it "should return the path of the file" do
|
631
|
-
expect(sanitized_file.path).not_to be_nil
|
632
|
-
expect(sanitized_file.path).to eq(file_path("llama.jpg"))
|
633
|
-
end
|
634
|
-
end
|
635
|
-
|
636
|
-
end
|
637
|
-
|
638
|
-
describe "with a valid Pathname" do
|
639
|
-
let(:sanitized_file) { CarrierWave::SanitizedFile.new(Pathname.new(file_path("llama.jpg"))) }
|
640
|
-
|
641
|
-
before do
|
642
|
-
FileUtils.copy_file(file_path("test.jpg"), file_path("llama.jpg"))
|
643
|
-
|
644
|
-
expect(sanitized_file).not_to be_empty
|
645
|
-
end
|
646
|
-
|
647
|
-
it_should_behave_like "all valid sanitized files"
|
648
|
-
|
649
|
-
it_should_behave_like "all valid sanitized files that are stored on disk"
|
650
|
-
|
651
|
-
describe "#is_path?" do
|
652
|
-
it "should be true" do
|
653
|
-
expect(sanitized_file.is_path?).to be_truthy
|
654
|
-
end
|
655
|
-
end
|
656
|
-
|
657
|
-
describe "#path" do
|
658
|
-
it "should return the path of the file" do
|
659
|
-
expect(sanitized_file.path).not_to be_nil
|
660
|
-
expect(sanitized_file.path).to eq(file_path("llama.jpg"))
|
661
|
-
end
|
662
|
-
end
|
663
|
-
|
664
|
-
end
|
665
|
-
|
666
|
-
describe "that is empty" do
|
667
|
-
let(:empty) { CarrierWave::SanitizedFile.new(nil) }
|
668
|
-
|
669
|
-
describe "#empty?" do
|
670
|
-
it "should be true" do
|
671
|
-
expect(empty).to be_empty
|
672
|
-
end
|
673
|
-
end
|
674
|
-
|
675
|
-
describe "#exists?" do
|
676
|
-
it "should be false" do
|
677
|
-
expect(empty.exists?).to be_falsey
|
678
|
-
end
|
679
|
-
end
|
680
|
-
|
681
|
-
describe "#is_path?" do
|
682
|
-
it "should be false" do
|
683
|
-
expect(empty.is_path?).to be_falsey
|
684
|
-
end
|
685
|
-
end
|
686
|
-
|
687
|
-
describe "#size" do
|
688
|
-
it "should be zero" do
|
689
|
-
expect(empty.size).to be_zero
|
690
|
-
end
|
691
|
-
end
|
692
|
-
|
693
|
-
describe "#path" do
|
694
|
-
it "should be nil" do
|
695
|
-
expect(empty.path).to be_nil
|
696
|
-
end
|
697
|
-
end
|
698
|
-
|
699
|
-
describe "#original_filename" do
|
700
|
-
it "should be nil" do
|
701
|
-
expect(empty.original_filename).to be_nil
|
702
|
-
end
|
703
|
-
end
|
704
|
-
|
705
|
-
describe "#filename" do
|
706
|
-
it "should be nil" do
|
707
|
-
expect(empty.filename).to be_nil
|
708
|
-
end
|
709
|
-
end
|
710
|
-
|
711
|
-
describe "#basename" do
|
712
|
-
it "should be nil" do
|
713
|
-
expect(empty.basename).to be_nil
|
714
|
-
end
|
715
|
-
end
|
716
|
-
|
717
|
-
describe "#extension" do
|
718
|
-
it "should be nil" do
|
719
|
-
expect(empty.extension).to be_nil
|
720
|
-
end
|
721
|
-
end
|
722
|
-
|
723
|
-
describe "#delete" do
|
724
|
-
it "should not raise an error" do
|
725
|
-
expect(running { empty.delete }).not_to raise_error
|
726
|
-
end
|
727
|
-
end
|
728
|
-
|
729
|
-
describe "#to_file" do
|
730
|
-
it "should be nil" do
|
731
|
-
expect(empty.to_file).to be_nil
|
732
|
-
end
|
733
|
-
end
|
734
|
-
end
|
735
|
-
|
736
|
-
describe "that is an empty string" do
|
737
|
-
let(:empty) { CarrierWave::SanitizedFile.new("") }
|
738
|
-
|
739
|
-
describe "#empty?" do
|
740
|
-
it "should be true" do
|
741
|
-
expect(empty).to be_empty
|
742
|
-
end
|
743
|
-
end
|
744
|
-
|
745
|
-
describe "#exists?" do
|
746
|
-
it "should be false" do
|
747
|
-
expect(empty.exists?).to be_falsey
|
748
|
-
end
|
749
|
-
end
|
750
|
-
|
751
|
-
describe "#is_path?" do
|
752
|
-
it "should be false" do
|
753
|
-
expect(empty.is_path?).to be_falsey
|
754
|
-
end
|
755
|
-
end
|
756
|
-
|
757
|
-
describe "#size" do
|
758
|
-
it "should be zero" do
|
759
|
-
expect(empty.size).to be_zero
|
760
|
-
end
|
761
|
-
end
|
762
|
-
|
763
|
-
describe "#path" do
|
764
|
-
it "should be nil" do
|
765
|
-
expect(empty.path).to be_nil
|
766
|
-
end
|
767
|
-
end
|
768
|
-
|
769
|
-
describe "#original_filename" do
|
770
|
-
it "should be nil" do
|
771
|
-
expect(empty.original_filename).to be_nil
|
772
|
-
end
|
773
|
-
end
|
774
|
-
|
775
|
-
describe "#filename" do
|
776
|
-
it "should be nil" do
|
777
|
-
expect(empty.filename).to be_nil
|
778
|
-
end
|
779
|
-
end
|
780
|
-
|
781
|
-
describe "#basename" do
|
782
|
-
it "should be nil" do
|
783
|
-
expect(empty.basename).to be_nil
|
784
|
-
end
|
785
|
-
end
|
786
|
-
|
787
|
-
describe "#extension" do
|
788
|
-
it "should be nil" do
|
789
|
-
expect(empty.extension).to be_nil
|
790
|
-
end
|
791
|
-
end
|
792
|
-
|
793
|
-
describe "#delete" do
|
794
|
-
it "should not raise an error" do
|
795
|
-
expect(running { empty.delete }).not_to raise_error
|
796
|
-
end
|
797
|
-
end
|
798
|
-
|
799
|
-
describe "#to_file" do
|
800
|
-
it "should be nil" do
|
801
|
-
expect(empty.to_file).to be_nil
|
802
|
-
end
|
803
|
-
end
|
804
|
-
end
|
805
|
-
end
|