alchemy_cms 3.1.3 → 3.2.0.beta
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/.editorconfig +2 -2
- data/.hound.yml +2 -0
- data/.rubocop.yml +1063 -0
- data/.travis.yml +14 -10
- data/Gemfile +4 -7
- data/README.md +16 -8
- data/alchemy_cms.gemspec +8 -7
- data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +10 -11
- data/app/assets/javascripts/alchemy/alchemy.js +1 -1
- data/app/assets/stylesheets/alchemy/{admin.css.scss → admin.scss} +1 -0
- data/app/assets/stylesheets/alchemy/{icon-font.css.scss → icon-font.scss} +0 -0
- data/app/assets/stylesheets/alchemy/{menubar.css.scss → menubar.scss} +0 -0
- data/app/assets/stylesheets/alchemy/{print.css.scss → print.scss} +0 -0
- data/app/assets/stylesheets/alchemy/selects.scss +0 -6
- data/app/controllers/alchemy/admin/contents_controller.rb +3 -4
- data/app/controllers/alchemy/admin/pictures_controller.rb +0 -2
- data/app/controllers/alchemy/api/contents_controller.rb +1 -1
- data/app/controllers/alchemy/api/elements_controller.rb +2 -2
- data/app/controllers/alchemy/api/pages_controller.rb +1 -1
- data/app/controllers/alchemy/elements_controller.rb +0 -6
- data/app/controllers/alchemy/pages_controller.rb +17 -13
- data/app/controllers/alchemy/pictures_controller.rb +1 -0
- data/app/helpers/alchemy/admin/navigation_helper.rb +1 -1
- data/app/models/alchemy/element.rb +41 -17
- data/app/models/alchemy/page/page_naming.rb +16 -29
- data/bin/alchemy +1 -1
- data/config/routes.rb +1 -2
- data/db/migrate/20130827094554_alchemy_two_point_six.rb +0 -17
- data/lib/alchemy/capistrano.rb +3 -4
- data/lib/alchemy/controller_actions.rb +2 -1
- data/lib/alchemy/engine.rb +1 -0
- data/lib/alchemy/errors.rb +7 -0
- data/lib/alchemy/essence.rb +4 -4
- data/lib/alchemy/permissions.rb +1 -1
- data/lib/alchemy/shell.rb +26 -11
- data/lib/alchemy/test_support/controller_requests.rb +48 -12
- data/lib/alchemy/upgrader.rb +1 -0
- data/lib/alchemy/upgrader/three_point_one.rb +0 -1
- data/lib/alchemy/upgrader/three_point_two.rb +39 -0
- data/lib/alchemy/version.rb +1 -1
- data/lib/rails/templates/alchemy.rb +2 -2
- data/lib/tasks/alchemy/install.rake +2 -1
- data/spec/controllers/admin/attachments_controller_spec.rb +14 -14
- data/spec/controllers/admin/clipboard_controller_spec.rb +5 -5
- data/spec/controllers/admin/contents_controller_spec.rb +8 -14
- data/spec/controllers/admin/dashboard_controller_spec.rb +12 -12
- data/spec/controllers/admin/elements_controller_spec.rb +30 -31
- data/spec/controllers/admin/essence_files_controller_spec.rb +6 -6
- data/spec/controllers/admin/essence_pictures_controller_spec.rb +17 -17
- data/spec/controllers/admin/languages_controller_spec.rb +3 -3
- data/spec/controllers/admin/layoutpages_controller_spec.rb +3 -3
- data/spec/controllers/admin/pages_controller_spec.rb +48 -48
- data/spec/controllers/admin/pictures_controller_spec.rb +19 -19
- data/spec/controllers/admin/resources_controller_spec.rb +2 -2
- data/spec/controllers/admin/trash_controller_spec.rb +5 -5
- data/spec/controllers/alchemy/admin/tags_controller_spec.rb +5 -5
- data/spec/controllers/alchemy/api/contents_controller_spec.rb +46 -11
- data/spec/controllers/alchemy/api/elements_controller_spec.rb +42 -14
- data/spec/controllers/alchemy/api/pages_controller_spec.rb +26 -16
- data/spec/controllers/attachments_controller_spec.rb +7 -7
- data/spec/controllers/elements_controller_spec.rb +16 -19
- data/spec/controllers/messages_controller_spec.rb +15 -15
- data/spec/controllers/pages_controller_spec.rb +16 -25
- data/spec/controllers/pictures_controller_spec.rb +75 -49
- data/spec/dummy/Rakefile +1 -1
- data/spec/dummy/app/assets/stylesheets/application.css +5 -3
- data/spec/dummy/config/application.rb +11 -1
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config/environments/development.rb +14 -2
- data/spec/dummy/config/environments/production.rb +18 -21
- data/spec/dummy/config/environments/test.rb +9 -4
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/mime_types.rb +0 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -1
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/migrate/20130827094554_alchemy_two_point_six.rb +380 -0
- data/spec/dummy/db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb +5 -0
- data/spec/dummy/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb +5 -0
- data/spec/dummy/db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb +5 -0
- data/spec/dummy/db/migrate/20150122213511_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +31 -0
- data/{db/migrate/20140107192720_add_missing_unique_indices_to_tags_and_taggings.rb → spec/dummy/db/migrate/20150122213512_add_missing_unique_indices.acts_as_taggable_on_engine.rb} +5 -6
- data/{db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb → spec/dummy/db/migrate/20150122213513_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb} +2 -1
- data/{db/migrate/20140701160225_add_missing_taggable_index.rb → spec/dummy/db/migrate/20150122213514_add_missing_taggable_index.acts_as_taggable_on_engine.rb} +1 -0
- data/spec/dummy/db/schema.rb +27 -31
- data/spec/dummy/public/404.html +20 -11
- data/spec/dummy/public/422.html +20 -11
- data/spec/dummy/public/500.html +19 -10
- data/spec/features/admin/page_creation_feature_spec.rb +2 -2
- data/spec/libraries/resource_spec.rb +1 -1
- data/spec/libraries/shell_spec.rb +2 -0
- data/spec/models/page_spec.rb +1 -13
- data/spec/spec_helper.rb +6 -4
- data/spec/support/rspec-activemodel-mocks_patch.rb +8 -0
- metadata +63 -56
- data/app/controllers/alchemy/contents_controller.rb +0 -18
- data/spec/controllers/contents_controller_spec.rb +0 -22
- data/spec/dummy/app/models/dummy_model.rb +0 -3
- data/spec/dummy/db/migrate/20130827094554_alchemy_two_point_six.rb +0 -1
- data/spec/dummy/db/migrate/20130828121054_remove_do_not_index_from_alchemy_essence_texts.rb +0 -1
- data/spec/dummy/db/migrate/20130828121120_remove_do_not_index_from_alchemy_essence_richtexts.rb +0 -1
- data/spec/dummy/db/migrate/20130918201742_add_published_at_to_alchemy_pages.rb +0 -1
- data/spec/dummy/db/migrate/20140107192720_add_missing_unique_indices_to_tags_and_taggings.rb +0 -1
- data/spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb +0 -1
- data/spec/dummy/db/migrate/20140701160225_add_missing_taggable_index.rb +0 -1
- data/spec/dummy/db/migrate/20150412103152_create_dummy_model.rb +0 -7
- data/spec/dummy/spec/javascripts +0 -1
- data/spec/models/dummy_model_spec.rb +0 -11
|
@@ -8,33 +8,45 @@ end
|
|
|
8
8
|
module Alchemy
|
|
9
9
|
describe PicturesController do
|
|
10
10
|
|
|
11
|
-
let(:public_page) {
|
|
12
|
-
let(:restricted_page) {
|
|
13
|
-
let(:element) {
|
|
14
|
-
let(:restricted_element) {
|
|
15
|
-
let(:picture) {
|
|
11
|
+
let(:public_page) { create(:public_page, restricted: false) }
|
|
12
|
+
let(:restricted_page) { create(:public_page, restricted: true) }
|
|
13
|
+
let(:element) { create(:element, page: public_page, name: 'bild', create_contents_after_create: true) }
|
|
14
|
+
let(:restricted_element) { create(:element, page: restricted_page, name: 'bild', create_contents_after_create: true) }
|
|
15
|
+
let(:picture) { create(:picture, image_file: fixture_file_upload(File.expand_path('../../fixtures/image.png', __FILE__), 'image/png')) }
|
|
16
16
|
|
|
17
17
|
describe '#zoom' do
|
|
18
|
-
let(:picture)
|
|
18
|
+
let(:picture) do
|
|
19
|
+
create(:picture, image_file: fixture_file_upload(File.expand_path('../../fixtures/80x60.png', __FILE__), 'image/png'))
|
|
20
|
+
end
|
|
19
21
|
|
|
20
22
|
before { sign_in(editor_user) }
|
|
21
23
|
|
|
22
24
|
it "renders the original image without any resizing" do
|
|
23
|
-
|
|
25
|
+
alchemy_get :zoom, id: picture.id, name: picture.urlname, format: :png, sh: picture.security_token
|
|
24
26
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([80, 60])
|
|
25
27
|
end
|
|
26
28
|
end
|
|
27
29
|
|
|
30
|
+
describe '#show' do
|
|
31
|
+
it "skips the session cookie" do
|
|
32
|
+
expect {
|
|
33
|
+
alchemy_get :show, id: picture.id, name: picture.urlname, format: :png, sh: picture.security_token
|
|
34
|
+
}.to change {
|
|
35
|
+
request.session_options.fetch(:skip) { false }
|
|
36
|
+
}.to(true)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
28
40
|
context "Requesting a picture with tempared security token" do
|
|
29
41
|
it "should render status 400" do
|
|
30
|
-
|
|
42
|
+
alchemy_get :show, id: picture.id, name: picture.urlname, format: :png, sh: '14m4b4dh4ck3r'
|
|
31
43
|
expect(response.status).to eq(400)
|
|
32
44
|
end
|
|
33
45
|
end
|
|
34
46
|
|
|
35
47
|
context "Requesting a picture with another format then the original image" do
|
|
36
48
|
it "should convert the picture format" do
|
|
37
|
-
|
|
49
|
+
alchemy_get :show, id: picture.id, name: picture.urlname, format: :jpeg, sh: picture.security_token
|
|
38
50
|
expect(response.content_type).to eq('image/jpeg')
|
|
39
51
|
end
|
|
40
52
|
end
|
|
@@ -42,47 +54,49 @@ module Alchemy
|
|
|
42
54
|
context "Requesting a picture with not allowed format" do
|
|
43
55
|
it "should raise error" do
|
|
44
56
|
expect {
|
|
45
|
-
|
|
57
|
+
alchemy_get :show, id: picture.id, name: picture.urlname, format: :wim, sh: picture.security_token
|
|
46
58
|
}.to raise_error(ActionController::UnknownFormat)
|
|
47
59
|
end
|
|
48
60
|
end
|
|
49
61
|
|
|
50
62
|
describe '#thumbnail' do
|
|
51
|
-
let(:picture)
|
|
63
|
+
let(:picture) do
|
|
64
|
+
create(:picture, image_file: fixture_file_upload(File.expand_path('../../fixtures/500x500.png', __FILE__), 'image/png'))
|
|
65
|
+
end
|
|
52
66
|
|
|
53
67
|
before { sign_in(author_user) }
|
|
54
68
|
|
|
55
69
|
context 'with size param set to small' do
|
|
56
70
|
it "resizes the image to 80x60 while maintaining aspect ratio" do
|
|
57
|
-
|
|
71
|
+
alchemy_get :thumbnail, id: picture.id, name: picture.urlname, size: 'small', format: :png, sh: picture.security_token(size: 'small')
|
|
58
72
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([60, 60])
|
|
59
73
|
end
|
|
60
74
|
end
|
|
61
75
|
|
|
62
76
|
context 'with size param set to medium' do
|
|
63
77
|
it "resizes the image to 160x120 while maintaining aspect ratio" do
|
|
64
|
-
|
|
78
|
+
alchemy_get :thumbnail, id: picture.id, name: picture.urlname, size: 'medium', format: :png, sh: picture.security_token(size: 'medium')
|
|
65
79
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([120, 120])
|
|
66
80
|
end
|
|
67
81
|
end
|
|
68
82
|
|
|
69
83
|
context 'with size param set to large' do
|
|
70
84
|
it "resizes the image to 240x180 while maintaining aspect ratio" do
|
|
71
|
-
|
|
85
|
+
alchemy_get :thumbnail, id: picture.id, name: picture.urlname, size: 'large', format: :png, sh: picture.security_token(size: 'large')
|
|
72
86
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([180, 180])
|
|
73
87
|
end
|
|
74
88
|
end
|
|
75
89
|
|
|
76
90
|
context 'with size param set to nil' do
|
|
77
91
|
it "resizes the image to 111x93 while maintaining aspect ratio" do
|
|
78
|
-
|
|
92
|
+
alchemy_get :thumbnail, id: picture.id, name: picture.urlname, format: :png, sh: picture.security_token
|
|
79
93
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([93, 93])
|
|
80
94
|
end
|
|
81
95
|
end
|
|
82
96
|
|
|
83
97
|
context 'with size param set to another value' do
|
|
84
98
|
it "resizes the image to the given size while maintaining aspect ratio" do
|
|
85
|
-
|
|
99
|
+
alchemy_get :thumbnail, id: picture.id, name: picture.urlname, size: '33x33', format: :png, sh: picture.security_token(size: '33x33')
|
|
86
100
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([33, 33])
|
|
87
101
|
end
|
|
88
102
|
end
|
|
@@ -96,16 +110,18 @@ module Alchemy
|
|
|
96
110
|
|
|
97
111
|
it "raises missing file error" do
|
|
98
112
|
expect {
|
|
99
|
-
|
|
113
|
+
alchemy_get :show, id: picture.id, name: picture.urlname, format: :png, sh: picture.security_token
|
|
100
114
|
}.to raise_error(Alchemy::MissingImageFileError)
|
|
101
115
|
end
|
|
102
116
|
end
|
|
103
117
|
|
|
104
118
|
context "Requesting a picture with crop_from and crop_size parameters" do
|
|
105
|
-
let(:picture)
|
|
119
|
+
let(:picture) do
|
|
120
|
+
create(:picture, image_file: fixture_file_upload(File.expand_path('../../fixtures/500x500.png', __FILE__), 'image/png'))
|
|
121
|
+
end
|
|
106
122
|
|
|
107
123
|
it "renders the cropped picture" do
|
|
108
|
-
|
|
124
|
+
alchemy_get :show, id: picture.id, name: picture.urlname, crop: 'crop', size: '123x44', crop_size: '123x44',
|
|
109
125
|
crop_from: '0x0', format: :png,
|
|
110
126
|
sh: picture.security_token(crop_size: '123x44', crop_from: '0x0', crop: true, size: '123x44')
|
|
111
127
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([123, 44])
|
|
@@ -113,11 +129,14 @@ module Alchemy
|
|
|
113
129
|
end
|
|
114
130
|
|
|
115
131
|
context "Requesting a picture with crop_from and crop_size parameters with different size param" do
|
|
116
|
-
let(:picture)
|
|
132
|
+
let(:picture) do
|
|
133
|
+
create(:picture, image_file: fixture_file_upload(File.expand_path('../../fixtures/500x500.png', __FILE__), 'image/png'))
|
|
134
|
+
end
|
|
117
135
|
|
|
118
136
|
it "renders the cropped picture" do
|
|
119
|
-
|
|
137
|
+
alchemy_get :show,
|
|
120
138
|
id: picture.id,
|
|
139
|
+
name: picture.urlname,
|
|
121
140
|
crop: 'crop',
|
|
122
141
|
size: '100x100',
|
|
123
142
|
crop_size: '200x200',
|
|
@@ -134,11 +153,14 @@ module Alchemy
|
|
|
134
153
|
end
|
|
135
154
|
|
|
136
155
|
context "Requesting a picture with crop_from and crop_size parameters with larger size param" do
|
|
137
|
-
let(:picture)
|
|
156
|
+
let(:picture) do
|
|
157
|
+
create(:picture, image_file: fixture_file_upload(File.expand_path('../../fixtures/500x500.png', __FILE__), 'image/png'))
|
|
158
|
+
end
|
|
138
159
|
|
|
139
160
|
it "renders the cropped picture without upsampling" do
|
|
140
|
-
|
|
161
|
+
alchemy_get :show,
|
|
141
162
|
id: picture.id,
|
|
163
|
+
name: picture.urlname,
|
|
142
164
|
crop: 'crop',
|
|
143
165
|
size: '400x400',
|
|
144
166
|
crop_size: '200x200',
|
|
@@ -155,11 +177,14 @@ module Alchemy
|
|
|
155
177
|
end
|
|
156
178
|
|
|
157
179
|
context "Requesting a picture with crop_from and crop_size parameters with larger size param and upsample set" do
|
|
158
|
-
let(:picture)
|
|
180
|
+
let(:picture) do
|
|
181
|
+
create(:picture, image_file: fixture_file_upload(File.expand_path('../../fixtures/500x500.png', __FILE__), 'image/png'))
|
|
182
|
+
end
|
|
159
183
|
|
|
160
184
|
it "renders the cropped picture with upsampling" do
|
|
161
|
-
|
|
185
|
+
alchemy_get :show,
|
|
162
186
|
id: picture.id,
|
|
187
|
+
name: picture.urlname,
|
|
163
188
|
crop: 'crop',
|
|
164
189
|
size: '400x400',
|
|
165
190
|
crop_size: '200x200',
|
|
@@ -179,7 +204,7 @@ module Alchemy
|
|
|
179
204
|
|
|
180
205
|
context "Requesting a picture that is not assigned with any page" do
|
|
181
206
|
it "should render the picture" do
|
|
182
|
-
|
|
207
|
+
alchemy_get :show, id: picture.id, name: picture.urlname, format: :png, sh: picture.security_token
|
|
183
208
|
expect(response.status).to eq(200)
|
|
184
209
|
end
|
|
185
210
|
end
|
|
@@ -197,7 +222,7 @@ module Alchemy
|
|
|
197
222
|
|
|
198
223
|
context "as guest user" do
|
|
199
224
|
it "should render the picture" do
|
|
200
|
-
|
|
225
|
+
alchemy_get :show, id: picture.id, name: picture.urlname, format: :png, sh: picture.security_token
|
|
201
226
|
expect(response.status).to eq(200)
|
|
202
227
|
end
|
|
203
228
|
end
|
|
@@ -212,7 +237,7 @@ module Alchemy
|
|
|
212
237
|
|
|
213
238
|
context "as guest user" do
|
|
214
239
|
it "should not render the picture, but redirect to login path" do
|
|
215
|
-
|
|
240
|
+
alchemy_get :show, id: picture.id, name: picture.urlname, format: :png, sh: picture.security_token
|
|
216
241
|
expect(response.status).to eq(302)
|
|
217
242
|
expect(response).to redirect_to(Alchemy.login_path)
|
|
218
243
|
end
|
|
@@ -224,14 +249,16 @@ module Alchemy
|
|
|
224
249
|
end
|
|
225
250
|
|
|
226
251
|
it "should render the picture" do
|
|
227
|
-
|
|
252
|
+
alchemy_get :show, id: picture.id, name: picture.urlname, format: :png, sh: picture.security_token
|
|
228
253
|
expect(response.status).to eq(200)
|
|
229
254
|
end
|
|
230
255
|
end
|
|
231
256
|
end
|
|
232
257
|
|
|
233
258
|
describe 'Picture processing' do
|
|
234
|
-
let(:big_picture)
|
|
259
|
+
let(:big_picture) do
|
|
260
|
+
create(:picture, image_file: fixture_file_upload(File.expand_path('../../fixtures/80x60.png', __FILE__), 'image/png'))
|
|
261
|
+
end
|
|
235
262
|
|
|
236
263
|
context "with crop and size parameters" do
|
|
237
264
|
it "should return a cropped image." do
|
|
@@ -240,20 +267,20 @@ module Alchemy
|
|
|
240
267
|
size: '10x10',
|
|
241
268
|
format: 'png'
|
|
242
269
|
}
|
|
243
|
-
|
|
270
|
+
alchemy_get :show, options.merge(id: big_picture.id, name: big_picture.urlname, sh: big_picture.security_token(options))
|
|
244
271
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([10,10])
|
|
245
272
|
end
|
|
246
273
|
|
|
247
274
|
context "without a full size specification" do
|
|
248
275
|
it "should raise an error" do
|
|
249
276
|
options = {
|
|
250
|
-
:
|
|
251
|
-
:
|
|
252
|
-
:
|
|
277
|
+
crop: 'crop',
|
|
278
|
+
size: '10',
|
|
279
|
+
format: 'png'
|
|
253
280
|
}
|
|
254
|
-
expect
|
|
255
|
-
|
|
256
|
-
|
|
281
|
+
expect {
|
|
282
|
+
alchemy_get :show, options.merge(id: big_picture.id, name: big_picture.urlname, sh: big_picture.security_token(options))
|
|
283
|
+
}.to raise_error ArgumentError
|
|
257
284
|
end
|
|
258
285
|
end
|
|
259
286
|
|
|
@@ -264,7 +291,7 @@ module Alchemy
|
|
|
264
291
|
size: '10x10',
|
|
265
292
|
format: 'png'
|
|
266
293
|
}
|
|
267
|
-
|
|
294
|
+
alchemy_get :show, options.merge(id: picture.id, name: big_picture.urlname, sh: picture.security_token(options))
|
|
268
295
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([1,1])
|
|
269
296
|
end
|
|
270
297
|
end
|
|
@@ -277,7 +304,7 @@ module Alchemy
|
|
|
277
304
|
upsample: 'true',
|
|
278
305
|
format: 'png'
|
|
279
306
|
}
|
|
280
|
-
|
|
307
|
+
alchemy_get :show, options.merge(id: picture.id, name: big_picture.urlname, sh: picture.security_token(options))
|
|
281
308
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([10,10])
|
|
282
309
|
end
|
|
283
310
|
end
|
|
@@ -286,32 +313,31 @@ module Alchemy
|
|
|
286
313
|
context "without crop but with size parameter" do
|
|
287
314
|
it "should resize the image preserving aspect ratio" do
|
|
288
315
|
options = {
|
|
289
|
-
:
|
|
290
|
-
:
|
|
316
|
+
size: '40x40',
|
|
317
|
+
format: 'png'
|
|
291
318
|
}
|
|
292
|
-
|
|
319
|
+
alchemy_get :show, options.merge(id: big_picture.id, name: big_picture.urlname, sh: big_picture.security_token(options))
|
|
293
320
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([40,30])
|
|
294
321
|
end
|
|
295
322
|
|
|
296
323
|
it "should resize the image inferring the height if not given" do
|
|
297
324
|
options = {
|
|
298
|
-
:
|
|
299
|
-
:
|
|
325
|
+
size: '40x',
|
|
326
|
+
format: 'png'
|
|
300
327
|
}
|
|
301
|
-
|
|
328
|
+
alchemy_get :show, options.merge(id: big_picture.id, name: big_picture.urlname, sh: big_picture.security_token(options))
|
|
302
329
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([40,30])
|
|
303
330
|
end
|
|
304
331
|
|
|
305
332
|
it "should resize the image inferring the width if not given" do
|
|
306
333
|
options = {
|
|
307
|
-
:
|
|
308
|
-
:
|
|
334
|
+
size: 'x30',
|
|
335
|
+
format: 'png'
|
|
309
336
|
}
|
|
310
|
-
|
|
337
|
+
alchemy_get :show, options.merge(id: big_picture.id, name: big_picture.urlname, sh: big_picture.security_token(options))
|
|
311
338
|
expect(response.body[0x10..0x18].unpack('NN')).to eq([40,30])
|
|
312
339
|
end
|
|
313
340
|
end
|
|
314
341
|
end
|
|
315
|
-
|
|
316
342
|
end
|
|
317
343
|
end
|
data/spec/dummy/Rakefile
CHANGED
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
6
|
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
7
|
*
|
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the
|
|
9
|
-
* compiled file
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
|
11
|
+
* file per style scope.
|
|
10
12
|
*
|
|
11
|
-
*= require_self
|
|
12
13
|
*= require_tree .
|
|
14
|
+
*= require_self
|
|
13
15
|
*/
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
require File.expand_path('../boot', __FILE__)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# Pick the frameworks you want:
|
|
4
|
+
require "active_record/railtie"
|
|
5
|
+
require "action_controller/railtie"
|
|
6
|
+
require "action_mailer/railtie"
|
|
7
|
+
require "action_view/railtie"
|
|
8
|
+
require "sprockets/railtie"
|
|
9
|
+
# require "rails/test_unit/railtie"
|
|
4
10
|
|
|
5
11
|
Bundler.require(*Rails.groups)
|
|
6
12
|
require "alchemy_cms"
|
|
@@ -18,5 +24,9 @@ module Dummy
|
|
|
18
24
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
19
25
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
20
26
|
# config.i18n.default_locale = :de
|
|
27
|
+
|
|
28
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
|
29
|
+
config.active_record.raise_in_transactional_callbacks = true
|
|
21
30
|
end
|
|
22
31
|
end
|
|
32
|
+
|
data/spec/dummy/config/boot.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Set up gems listed in the Gemfile.
|
|
2
2
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
|
3
3
|
|
|
4
|
-
require 'bundler/setup' if File.
|
|
4
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
|
5
5
|
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
Rails.application.configure do
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
3
|
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
|
@@ -19,11 +19,23 @@ Dummy::Application.configure do
|
|
|
19
19
|
# Print deprecation notices to the Rails logger.
|
|
20
20
|
config.active_support.deprecation = :log
|
|
21
21
|
|
|
22
|
-
# Raise an error on page load if there are pending migrations
|
|
22
|
+
# Raise an error on page load if there are pending migrations.
|
|
23
23
|
config.active_record.migration_error = :page_load
|
|
24
24
|
|
|
25
25
|
# Debug mode disables concatenation and preprocessing of assets.
|
|
26
26
|
# This option may cause significant delays in view rendering with a large
|
|
27
27
|
# number of complex assets.
|
|
28
28
|
config.assets.debug = true
|
|
29
|
+
|
|
30
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
|
31
|
+
# yet still be able to expire them through the digest params.
|
|
32
|
+
config.assets.digest = true
|
|
33
|
+
|
|
34
|
+
# Adds additional error checking when serving assets at runtime.
|
|
35
|
+
# Checks for improperly declared sprockets dependencies.
|
|
36
|
+
# Raises helpful error messages.
|
|
37
|
+
config.assets.raise_runtime_errors = true
|
|
38
|
+
|
|
39
|
+
# Raises error for missing translations
|
|
40
|
+
# config.action_view.raise_on_missing_translations = true
|
|
29
41
|
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
Rails.application.configure do
|
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
3
|
|
|
4
4
|
# Code is not reloaded between requests.
|
|
5
5
|
config.cache_classes = true
|
|
6
6
|
|
|
7
7
|
# Eager load code on boot. This eager loads most of Rails and
|
|
8
|
-
# your application in memory, allowing both
|
|
8
|
+
# your application in memory, allowing both threaded web servers
|
|
9
9
|
# and those relying on copy on write to perform better.
|
|
10
10
|
# Rake tasks automatically ignore this option for performance.
|
|
11
11
|
config.eager_load = true
|
|
@@ -16,11 +16,12 @@ Dummy::Application.configure do
|
|
|
16
16
|
|
|
17
17
|
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
|
18
18
|
# Add `rack-cache` to your Gemfile before enabling this.
|
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like
|
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like
|
|
20
|
+
# NGINX, varnish or squid.
|
|
20
21
|
# config.action_dispatch.rack_cache = true
|
|
21
22
|
|
|
22
|
-
# Disable Rails's static asset server (Apache or
|
|
23
|
-
config.
|
|
23
|
+
# Disable Rails's static asset server (Apache or NGINX will already do this).
|
|
24
|
+
config.serve_static_files = false
|
|
24
25
|
|
|
25
26
|
# Compress JavaScripts and CSS.
|
|
26
27
|
config.assets.js_compressor = :uglifier
|
|
@@ -29,21 +30,21 @@ Dummy::Application.configure do
|
|
|
29
30
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
|
30
31
|
config.assets.compile = true
|
|
31
32
|
|
|
32
|
-
#
|
|
33
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
|
34
|
+
# yet still be able to expire them through the digest params.
|
|
33
35
|
config.assets.digest = true
|
|
34
36
|
|
|
35
|
-
#
|
|
36
|
-
config.assets.version = '1.0'
|
|
37
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
|
37
38
|
|
|
38
39
|
# Specifies the header that your server uses for sending files.
|
|
39
|
-
# config.action_dispatch.x_sendfile_header =
|
|
40
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for
|
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
|
41
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
|
41
42
|
|
|
42
43
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
43
44
|
# config.force_ssl = true
|
|
44
45
|
|
|
45
|
-
#
|
|
46
|
-
config.log_level = :info
|
|
46
|
+
# Decrease the log volume.
|
|
47
|
+
# config.log_level = :info
|
|
47
48
|
|
|
48
49
|
# Prepend all log lines with the following tags.
|
|
49
50
|
# config.log_tags = [ :subdomain, :uuid ]
|
|
@@ -55,26 +56,22 @@ Dummy::Application.configure do
|
|
|
55
56
|
# config.cache_store = :mem_cache_store
|
|
56
57
|
|
|
57
58
|
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
58
|
-
# config.action_controller.asset_host =
|
|
59
|
-
|
|
60
|
-
# Precompile additional assets.
|
|
61
|
-
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
|
62
|
-
# config.assets.precompile += %w( search.js )
|
|
59
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
|
63
60
|
|
|
64
61
|
# Ignore bad email addresses and do not raise email delivery errors.
|
|
65
62
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
66
63
|
# config.action_mailer.raise_delivery_errors = false
|
|
67
64
|
|
|
68
65
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
69
|
-
# the I18n.default_locale when a translation
|
|
66
|
+
# the I18n.default_locale when a translation cannot be found).
|
|
70
67
|
config.i18n.fallbacks = true
|
|
71
68
|
|
|
72
69
|
# Send deprecation notices to registered listeners.
|
|
73
70
|
config.active_support.deprecation = :notify
|
|
74
71
|
|
|
75
|
-
# Disable automatic flushing of the log to improve performance.
|
|
76
|
-
# config.autoflush_log = false
|
|
77
|
-
|
|
78
72
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
79
73
|
config.log_formatter = ::Logger::Formatter.new
|
|
74
|
+
|
|
75
|
+
# Do not dump schema after migrations.
|
|
76
|
+
config.active_record.dump_schema_after_migration = false
|
|
80
77
|
end
|