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,394 +0,0 @@
|
|
1
|
-
module CarrierWave
|
2
|
-
module Test
|
3
|
-
|
4
|
-
##
|
5
|
-
# These are some matchers that can be used in RSpec specs, to simplify the testing
|
6
|
-
# of uploaders.
|
7
|
-
#
|
8
|
-
module Matchers
|
9
|
-
|
10
|
-
class BeIdenticalTo # :nodoc:
|
11
|
-
def initialize(expected)
|
12
|
-
@expected = expected
|
13
|
-
end
|
14
|
-
|
15
|
-
def matches?(actual)
|
16
|
-
@actual = actual
|
17
|
-
FileUtils.identical?(@actual, @expected)
|
18
|
-
end
|
19
|
-
|
20
|
-
def failure_message
|
21
|
-
"expected #{@actual.inspect} to be identical to #{@expected.inspect}"
|
22
|
-
end
|
23
|
-
|
24
|
-
def failure_message_when_negated
|
25
|
-
"expected #{@actual.inspect} to not be identical to #{@expected.inspect}"
|
26
|
-
end
|
27
|
-
|
28
|
-
def description
|
29
|
-
"be identical to #{@expected.inspect}"
|
30
|
-
end
|
31
|
-
|
32
|
-
# RSpec 2 compatibility:
|
33
|
-
alias_method :negative_failure_message, :failure_message_when_negated
|
34
|
-
end
|
35
|
-
|
36
|
-
def be_identical_to(expected)
|
37
|
-
BeIdenticalTo.new(expected)
|
38
|
-
end
|
39
|
-
|
40
|
-
class HavePermissions # :nodoc:
|
41
|
-
def initialize(expected)
|
42
|
-
@expected = expected
|
43
|
-
end
|
44
|
-
|
45
|
-
def matches?(actual)
|
46
|
-
@actual = actual
|
47
|
-
# Satisfy expectation here. Return false or raise an error if it's not met.
|
48
|
-
(File.stat(@actual.path).mode & 0777) == @expected
|
49
|
-
end
|
50
|
-
|
51
|
-
def failure_message
|
52
|
-
"expected #{@actual.current_path.inspect} to have permissions #{@expected.to_s(8)}, but they were #{(File.stat(@actual.path).mode & 0777).to_s(8)}"
|
53
|
-
end
|
54
|
-
|
55
|
-
def failure_message_when_negated
|
56
|
-
"expected #{@actual.current_path.inspect} not to have permissions #{@expected.to_s(8)}, but it did"
|
57
|
-
end
|
58
|
-
|
59
|
-
def description
|
60
|
-
"have permissions #{@expected.to_s(8)}"
|
61
|
-
end
|
62
|
-
|
63
|
-
# RSpec 2 compatibility:
|
64
|
-
alias_method :negative_failure_message, :failure_message_when_negated
|
65
|
-
end
|
66
|
-
|
67
|
-
def have_permissions(expected)
|
68
|
-
HavePermissions.new(expected)
|
69
|
-
end
|
70
|
-
|
71
|
-
class HaveDirectoryPermissions # :nodoc:
|
72
|
-
def initialize(expected)
|
73
|
-
@expected = expected
|
74
|
-
end
|
75
|
-
|
76
|
-
def matches?(actual)
|
77
|
-
@actual = actual
|
78
|
-
# Satisfy expectation here. Return false or raise an error if it's not met.
|
79
|
-
(File.stat(File.dirname @actual.path).mode & 0777) == @expected
|
80
|
-
end
|
81
|
-
|
82
|
-
def failure_message
|
83
|
-
"expected #{File.dirname @actual.current_path.inspect} to have permissions #{@expected.to_s(8)}, but they were #{(File.stat(@actual.path).mode & 0777).to_s(8)}"
|
84
|
-
end
|
85
|
-
|
86
|
-
def failure_message_when_negated
|
87
|
-
"expected #{File.dirname @actual.current_path.inspect} not to have permissions #{@expected.to_s(8)}, but it did"
|
88
|
-
end
|
89
|
-
|
90
|
-
def description
|
91
|
-
"have permissions #{@expected.to_s(8)}"
|
92
|
-
end
|
93
|
-
|
94
|
-
# RSpec 2 compatibility:
|
95
|
-
alias_method :negative_failure_message, :failure_message_when_negated
|
96
|
-
end
|
97
|
-
|
98
|
-
def have_directory_permissions(expected)
|
99
|
-
HaveDirectoryPermissions.new(expected)
|
100
|
-
end
|
101
|
-
|
102
|
-
class BeNoLargerThan # :nodoc:
|
103
|
-
def initialize(width, height)
|
104
|
-
@width, @height = width, height
|
105
|
-
end
|
106
|
-
|
107
|
-
def matches?(actual)
|
108
|
-
@actual = actual
|
109
|
-
# Satisfy expectation here. Return false or raise an error if it's not met.
|
110
|
-
image = ImageLoader.load_image(@actual.current_path)
|
111
|
-
@actual_width = image.width
|
112
|
-
@actual_height = image.height
|
113
|
-
@actual_width <= @width && @actual_height <= @height
|
114
|
-
end
|
115
|
-
|
116
|
-
def failure_message
|
117
|
-
"expected #{@actual.current_path.inspect} to be no larger than #{@width} by #{@height}, but it was #{@actual_width} by #{@actual_height}."
|
118
|
-
end
|
119
|
-
|
120
|
-
def failure_message_when_negated
|
121
|
-
"expected #{@actual.current_path.inspect} to be larger than #{@width} by #{@height}, but it wasn't."
|
122
|
-
end
|
123
|
-
|
124
|
-
def description
|
125
|
-
"be no larger than #{@width} by #{@height}"
|
126
|
-
end
|
127
|
-
|
128
|
-
# RSpec 2 compatibility:
|
129
|
-
alias_method :negative_failure_message, :failure_message_when_negated
|
130
|
-
end
|
131
|
-
|
132
|
-
def be_no_larger_than(width, height)
|
133
|
-
BeNoLargerThan.new(width, height)
|
134
|
-
end
|
135
|
-
|
136
|
-
class HaveDimensions # :nodoc:
|
137
|
-
def initialize(width, height)
|
138
|
-
@width, @height = width, height
|
139
|
-
end
|
140
|
-
|
141
|
-
def matches?(actual)
|
142
|
-
@actual = actual
|
143
|
-
# Satisfy expectation here. Return false or raise an error if it's not met.
|
144
|
-
image = ImageLoader.load_image(@actual.current_path)
|
145
|
-
@actual_width = image.width
|
146
|
-
@actual_height = image.height
|
147
|
-
@actual_width == @width && @actual_height == @height
|
148
|
-
end
|
149
|
-
|
150
|
-
def failure_message
|
151
|
-
"expected #{@actual.current_path.inspect} to have an exact size of #{@width} by #{@height}, but it was #{@actual_width} by #{@actual_height}."
|
152
|
-
end
|
153
|
-
|
154
|
-
def failure_message_when_negated
|
155
|
-
"expected #{@actual.current_path.inspect} not to have an exact size of #{@width} by #{@height}, but it did."
|
156
|
-
end
|
157
|
-
|
158
|
-
def description
|
159
|
-
"have an exact size of #{@width} by #{@height}"
|
160
|
-
end
|
161
|
-
|
162
|
-
# RSpec 2 compatibility:
|
163
|
-
alias_method :negative_failure_message, :failure_message_when_negated
|
164
|
-
end
|
165
|
-
|
166
|
-
def have_dimensions(width, height)
|
167
|
-
HaveDimensions.new(width, height)
|
168
|
-
end
|
169
|
-
|
170
|
-
class HaveHeight # :nodoc:
|
171
|
-
def initialize(height)
|
172
|
-
@height = height
|
173
|
-
end
|
174
|
-
|
175
|
-
def matches?(actual)
|
176
|
-
@actual = actual
|
177
|
-
# Satisfy expectation here. Return false or raise an error if it's not met.
|
178
|
-
image = ImageLoader.load_image(@actual.current_path)
|
179
|
-
@actual_height = image.height
|
180
|
-
@actual_height == @height
|
181
|
-
end
|
182
|
-
|
183
|
-
def failure_message
|
184
|
-
"expected #{@actual.current_path.inspect} to have an exact size of #{@height}, but it was #{@actual_height}."
|
185
|
-
end
|
186
|
-
|
187
|
-
def failure_message_when_negated
|
188
|
-
"expected #{@actual.current_path.inspect} not to have an exact size of #{@height}, but it did."
|
189
|
-
end
|
190
|
-
|
191
|
-
def description
|
192
|
-
"have an exact height of #{@height}"
|
193
|
-
end
|
194
|
-
|
195
|
-
# RSpec 2 compatibility:
|
196
|
-
alias_method :negative_failure_message, :failure_message_when_negated
|
197
|
-
end
|
198
|
-
|
199
|
-
def have_height(height)
|
200
|
-
HaveHeight.new(height)
|
201
|
-
end
|
202
|
-
|
203
|
-
class HaveWidth # :nodoc:
|
204
|
-
def initialize(width)
|
205
|
-
@width = width
|
206
|
-
end
|
207
|
-
|
208
|
-
def matches?(actual)
|
209
|
-
@actual = actual
|
210
|
-
# Satisfy expectation here. Return false or raise an error if it's not met.
|
211
|
-
image = ImageLoader.load_image(@actual.current_path)
|
212
|
-
@actual_width = image.width
|
213
|
-
@actual_width == @width
|
214
|
-
end
|
215
|
-
|
216
|
-
def failure_message
|
217
|
-
"expected #{@actual.current_path.inspect} to have an exact size of #{@width}, but it was #{@actual_width}."
|
218
|
-
end
|
219
|
-
|
220
|
-
def failure_message_when_negated
|
221
|
-
"expected #{@actual.current_path.inspect} not to have an exact size of #{@width}, but it did."
|
222
|
-
end
|
223
|
-
|
224
|
-
def description
|
225
|
-
"have an exact width of #{@width}"
|
226
|
-
end
|
227
|
-
|
228
|
-
# RSpec 2 compatibility:
|
229
|
-
alias_method :negative_failure_message, :failure_message_when_negated
|
230
|
-
end
|
231
|
-
|
232
|
-
def have_width(width)
|
233
|
-
HaveWidth.new(width)
|
234
|
-
end
|
235
|
-
|
236
|
-
class BeNoWiderThan # :nodoc:
|
237
|
-
def initialize(width)
|
238
|
-
@width = width
|
239
|
-
end
|
240
|
-
|
241
|
-
def matches?(actual)
|
242
|
-
@actual = actual
|
243
|
-
# Satisfy expectation here. Return false or raise an error if it's not met.
|
244
|
-
image = ImageLoader.load_image(@actual.current_path)
|
245
|
-
@actual_width = image.width
|
246
|
-
@actual_width <= @width
|
247
|
-
end
|
248
|
-
|
249
|
-
def failure_message
|
250
|
-
"expected #{@actual.current_path.inspect} to be no wider than #{@width}, but it was #{@actual_width}."
|
251
|
-
end
|
252
|
-
|
253
|
-
def failure_message_when_negated
|
254
|
-
"expected #{@actual.current_path.inspect} not to be wider than #{@width}, but it is."
|
255
|
-
end
|
256
|
-
|
257
|
-
def description
|
258
|
-
"have a width less than or equal to #{@width}"
|
259
|
-
end
|
260
|
-
|
261
|
-
# RSpec 2 compatibility:
|
262
|
-
alias_method :negative_failure_message, :failure_message_when_negated
|
263
|
-
end
|
264
|
-
|
265
|
-
def be_no_wider_than(width)
|
266
|
-
BeNoWiderThan.new(width)
|
267
|
-
end
|
268
|
-
|
269
|
-
class BeNoTallerThan # :nodoc:
|
270
|
-
def initialize(height)
|
271
|
-
@height = height
|
272
|
-
end
|
273
|
-
|
274
|
-
def matches?(actual)
|
275
|
-
@actual = actual
|
276
|
-
# Satisfy expectation here. Return false or raise an error if it's not met.
|
277
|
-
image = ImageLoader.load_image(@actual.current_path)
|
278
|
-
@actual_height = image.height
|
279
|
-
@actual_height <= @height
|
280
|
-
end
|
281
|
-
|
282
|
-
def failure_message
|
283
|
-
"expected #{@actual.current_path.inspect} to be no taller than #{@height}, but it was #{@actual_height}."
|
284
|
-
end
|
285
|
-
|
286
|
-
def failure_message_when_negated
|
287
|
-
"expected #{@actual.current_path.inspect} not to be taller than #{@height}, but it is."
|
288
|
-
end
|
289
|
-
|
290
|
-
def description
|
291
|
-
"have a height less than or equal to #{@height}"
|
292
|
-
end
|
293
|
-
|
294
|
-
# RSpec 2 compatibility:
|
295
|
-
alias_method :negative_failure_message, :failure_message_when_negated
|
296
|
-
end
|
297
|
-
|
298
|
-
def be_no_taller_than(height)
|
299
|
-
BeNoTallerThan.new(height)
|
300
|
-
end
|
301
|
-
|
302
|
-
class BeFormat # :nodoc:
|
303
|
-
def initialize(expected)
|
304
|
-
@expected = expected
|
305
|
-
end
|
306
|
-
|
307
|
-
def matches?(actual)
|
308
|
-
@actual = actual
|
309
|
-
# Satisfy expectation here. Return false or raise an error if it's not met.
|
310
|
-
image = ImageLoader.load_image(@actual.current_path)
|
311
|
-
@actual_expected = image.format
|
312
|
-
!@expected.nil? && @actual_expected.casecmp(@expected).zero?
|
313
|
-
end
|
314
|
-
|
315
|
-
def failure_message
|
316
|
-
"expected #{@actual.current_path.inspect} to have #{@expected} format, but it was #{@actual_expected}."
|
317
|
-
end
|
318
|
-
|
319
|
-
def failure_message_when_negated
|
320
|
-
"expected #{@actual.current_path.inspect} not to have #{@expected} format, but it did."
|
321
|
-
end
|
322
|
-
|
323
|
-
def description
|
324
|
-
"have #{@expected} format"
|
325
|
-
end
|
326
|
-
|
327
|
-
# RSpec 2 compatibility:
|
328
|
-
alias_method :negative_failure_message, :failure_message_when_negated
|
329
|
-
end
|
330
|
-
|
331
|
-
def be_format(expected)
|
332
|
-
BeFormat.new(expected)
|
333
|
-
end
|
334
|
-
|
335
|
-
class ImageLoader # :nodoc:
|
336
|
-
def self.load_image(filename)
|
337
|
-
if defined? ::MiniMagick
|
338
|
-
MiniMagickWrapper.new(filename)
|
339
|
-
else
|
340
|
-
unless defined? ::Magick
|
341
|
-
begin
|
342
|
-
require 'rmagick'
|
343
|
-
rescue LoadError
|
344
|
-
require 'RMagick'
|
345
|
-
rescue LoadError
|
346
|
-
puts "WARNING: Failed to require rmagick, image processing may fail!"
|
347
|
-
end
|
348
|
-
end
|
349
|
-
MagickWrapper.new(filename)
|
350
|
-
end
|
351
|
-
end
|
352
|
-
end
|
353
|
-
|
354
|
-
class MagickWrapper # :nodoc:
|
355
|
-
attr_reader :image
|
356
|
-
def width
|
357
|
-
image.columns
|
358
|
-
end
|
359
|
-
|
360
|
-
def height
|
361
|
-
image.rows
|
362
|
-
end
|
363
|
-
|
364
|
-
def format
|
365
|
-
image.format
|
366
|
-
end
|
367
|
-
|
368
|
-
def initialize(filename)
|
369
|
-
@image = ::Magick::Image.read(filename).first
|
370
|
-
end
|
371
|
-
end
|
372
|
-
|
373
|
-
class MiniMagickWrapper # :nodoc:
|
374
|
-
attr_reader :image
|
375
|
-
def width
|
376
|
-
image[:width]
|
377
|
-
end
|
378
|
-
|
379
|
-
def height
|
380
|
-
image[:height]
|
381
|
-
end
|
382
|
-
|
383
|
-
def format
|
384
|
-
image[:format]
|
385
|
-
end
|
386
|
-
|
387
|
-
def initialize(filename)
|
388
|
-
@image = ::MiniMagick::Image.open(filename)
|
389
|
-
end
|
390
|
-
end
|
391
|
-
|
392
|
-
end # Matchers
|
393
|
-
end # Test
|
394
|
-
end # CarrierWave
|
@@ -1,67 +0,0 @@
|
|
1
|
-
require "carrierwave/uploader/configuration"
|
2
|
-
require "carrierwave/uploader/callbacks"
|
3
|
-
require "carrierwave/uploader/proxy"
|
4
|
-
require "carrierwave/uploader/url"
|
5
|
-
require "carrierwave/uploader/mountable"
|
6
|
-
require "carrierwave/uploader/cache"
|
7
|
-
require "carrierwave/uploader/store"
|
8
|
-
require "carrierwave/uploader/download"
|
9
|
-
require "carrierwave/uploader/remove"
|
10
|
-
require "carrierwave/uploader/extension_whitelist"
|
11
|
-
require "carrierwave/uploader/extension_blacklist"
|
12
|
-
require "carrierwave/uploader/content_type_whitelist"
|
13
|
-
require "carrierwave/uploader/content_type_blacklist"
|
14
|
-
require "carrierwave/uploader/file_size"
|
15
|
-
require "carrierwave/uploader/processing"
|
16
|
-
require "carrierwave/uploader/versions"
|
17
|
-
require "carrierwave/uploader/default_url"
|
18
|
-
|
19
|
-
require "carrierwave/uploader/serialization"
|
20
|
-
|
21
|
-
module CarrierWave
|
22
|
-
|
23
|
-
##
|
24
|
-
# See CarrierWave::Uploader::Base
|
25
|
-
#
|
26
|
-
module Uploader
|
27
|
-
|
28
|
-
##
|
29
|
-
# An uploader is a class that allows you to easily handle the caching and storage of
|
30
|
-
# uploaded files. Please refer to the README for configuration options.
|
31
|
-
#
|
32
|
-
# Once you have an uploader you can use it in isolation:
|
33
|
-
#
|
34
|
-
# my_uploader = MyUploader.new
|
35
|
-
# my_uploader.cache!(File.open(path_to_file))
|
36
|
-
# my_uploader.retrieve_from_store!('monkey.png')
|
37
|
-
#
|
38
|
-
# Alternatively, you can mount it on an ORM or other persistence layer, with
|
39
|
-
# +CarrierWave::Mount#mount_uploader+. There are extensions for activerecord and datamapper
|
40
|
-
# these are *very* simple (they are only a dozen lines of code), so adding your own should
|
41
|
-
# be trivial.
|
42
|
-
#
|
43
|
-
class Base
|
44
|
-
attr_reader :file
|
45
|
-
|
46
|
-
include CarrierWave::Uploader::Configuration
|
47
|
-
include CarrierWave::Uploader::Callbacks
|
48
|
-
include CarrierWave::Uploader::Proxy
|
49
|
-
include CarrierWave::Uploader::Url
|
50
|
-
include CarrierWave::Uploader::Mountable
|
51
|
-
include CarrierWave::Uploader::Cache
|
52
|
-
include CarrierWave::Uploader::Store
|
53
|
-
include CarrierWave::Uploader::Download
|
54
|
-
include CarrierWave::Uploader::Remove
|
55
|
-
include CarrierWave::Uploader::ExtensionWhitelist
|
56
|
-
include CarrierWave::Uploader::ExtensionBlacklist
|
57
|
-
include CarrierWave::Uploader::ContentTypeWhitelist
|
58
|
-
include CarrierWave::Uploader::ContentTypeBlacklist
|
59
|
-
include CarrierWave::Uploader::FileSize
|
60
|
-
include CarrierWave::Uploader::Processing
|
61
|
-
include CarrierWave::Uploader::Versions
|
62
|
-
include CarrierWave::Uploader::DefaultUrl
|
63
|
-
include CarrierWave::Uploader::Serialization
|
64
|
-
end # Base
|
65
|
-
|
66
|
-
end # Uploader
|
67
|
-
end # CarrierWave
|