trusty-clipped-extension 2.0.2.pre.beta → 2.0.3.pre.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Gemfile +45 -1
- data/Gemfile.lock +88 -11
- data/Rakefile +26 -110
- data/app/assets/javascripts/admin/assets.js +4 -4
- data/app/assets/stylesheets/admin/assets.sass +2 -4
- data/app/controllers/admin/assets_controller.rb +3 -1
- data/app/views/admin/assets/_asset_table.html.haml +1 -0
- data/app/views/admin/assets/_form.html.haml +3 -3
- data/app/views/admin/assets/_page_assets.html.haml +1 -1
- data/app/views/admin/assets/edit.html.haml +3 -3
- data/app/views/admin/assets/index.html.haml +2 -3
- data/app/views/admin/assets/new.html.haml +18 -18
- data/app/views/admin/assets/remove.html.haml +1 -1
- data/app/views/admin/pages/_assets.html.haml +7 -5
- data/config/application.rb +136 -0
- data/config/boot.rb +8 -0
- data/config/environment.rb +5 -0
- data/config/locales/en.yml +1 -1
- data/lib/trusty-clipped-extension.rb +1 -1
- data/rebuild +5 -0
- data/spec/ci/database.mysql.yml +27 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +5 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config/application.rb +152 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/database.yml +28 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +49 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/trusty_cms_config.rb +20 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +0 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/schema.rb +144 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/cache/747/A70/TrustyCms%3A%3AConfig +0 -0
- data/spec/dummy/tmp/cache/85C/FA0/TrustyCms.cache_mtime +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/4efd780dc9118042804451835b878259e2afc5d1/_base.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/4efd780dc9118042804451835b878259e2afc5d1/main.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/66b1a0010012929c45ead4236f8cf67ab5e3ad10/_boxes.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/66b1a0010012929c45ead4236f8cf67ab5e3ad10/_gradients.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/66b1a0010012929c45ead4236f8cf67ab5e3ad10/_links.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_actions.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_avatars.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_content.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_dateinput.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_deprecated.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_dropdown.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_footer.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_forms.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_header.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_index.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_jquery-ui-structure.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_jquery-ui-theme.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_jquery-ui.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_layout.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_messages.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_popup.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_tabcontrol.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_toolbar.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_treetable.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_typography.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sass/8d307e13c2e74a3d7d4d0eecd3e5daf9e7b1293d/_validations.scssc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0253c2b6b6b5d225c38e795a508043e3 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/05634c84f3e97c2e300a0988e9c571b4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/07c2bf9b54e44d186c3dc4fe775bf217 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0a5bab0f5c49aafe2bef1ad4f0fdaa95 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0b12b1d454f82ce157eba2a99c57b1c5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0d0f578e1d526a5592454fd915f28722 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/118a0efcdfc1be878d85967fb9eab9ab +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/126b3a20fbb3ee31f8d29ce1c0a3bae1 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/128df4bcf253b7dbb8bb8b6bd40b92d5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/133ae3a6ec8ce5c435266446d406c497 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/13da4e71b104d636208b7ea380c9028b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/1a0cf8baad9957cea0290cac02ee4324 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/22a8f218bcf0b68fecca4d5aa7b728b9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/276aad4896e9ee6929626bcea973ec2f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/27977269178c1332d1b0085b9830c8c7 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2960553254e8b34684bd62fcd9ebcc88 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/298838d1f354a7ce98875c7225e6a6a7 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/29d248927769199391aa7c6b060730f2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2b29e5c4175ed37eae13bb9445cd0398 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2c6aad6774b77dd0212ff0921a552fda +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2e05b1c8f1f2eaa2c143c1097921fbaf +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/30f472e5b1cb95fcada64f956701fcfe +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3722e239d8e0fc45691762190af60480 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/3cc3bb17b7fbe5eeeb9e2fd59f353ac2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4036e4e74ec8caaf31ebfa8200b11fc6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4bde469b10d79020fae3d263ac3d7c41 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/4dba5139e0cb793331971197e100dab7 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/50340e99333efe25311ff69d804d0044 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/566ea75053eeef9a45333422ebe11758 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/57ba3771151e2d17eb1f1df421fe8a96 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5a8e4705d0930604da5dad00d49e7f49 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5eed3bf8cfe6dcb764bea5c574d2d9c9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/5f879c30ff953be36c9bd3bc12c58b15 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/649393b36e60cee5747d66aa96862184 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/649cb21e9d0e916026c8ff574f21cb7d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/65aef06e5485abe748ec0f8ab5e83fa5 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6745248fbc6beb42d1ab2b04b63c5c1a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6781fb6027c64b314bd774aa672574f6 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6b3ab0bc5c8316baa291af39f5c44038 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/6da37e398c8c9f006f6b544cd714d834 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/72ce50f2edca010cee5ad75904a615c9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/74021cd8376ee1203af17bed0d2bf27f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/76d535649eb9bd798d9e1e9f64860451 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7b3ae6ac77163f1d1c0bac4b66d0d910 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7e97394489bc5dd3989b7dcdbd33d080 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/7eaf5a863f069a5571b3b0e12f2167fb +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8117019177512a419d0852f3d871604e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8211e5da25cd8db999f3e83acc70b884 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/82426bfd2b08cc8ec14a62d560643a8c +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/83eee805228b7b26a9e9027d05b95402 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/858821775db3375fa2cdcfb2e1efe3cd +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/8cdfbf142f9e5dcb6785a6e61ca4861e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9316fc95ea7bd5108f6838f6c7e7be4e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/95e0849d56a2a9e1e55d874be2c04ae2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/965a1812be0bfc82e220e7f22ae384dc +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a1832984208c42e9a47980b4d6ac2dc9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/a1e86c22b2e6cfbcdf9d68792bcedb7f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ad62c91ea509a5e8e4caf11c4922f392 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b06ccd7385c6bd56ee7c6562a97e6b85 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b2f5b7fb5cbed27d897a0368d4a6d5d2 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b7505543b40b8ab466e9efe586d95346 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/bab4140b592b87efaf49c7bf60598425 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/baf8b56ddb9ca0245e093e29ade35c0a +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/be3cf8499757ed7678ee0a25d4aa3112 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/be5b781b3de58aa915133b4d41b76a0b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c0fc05e9c36943a5437ef516f58ebcd8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/cb78e79ec2dd8bccf18927386de178ae +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/d2b5bbda0041b5ef56873dc8941d5ad9 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/dcc163a0f3096123d374f5632ad48d4b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/df7b2d1131b58c69eef783a1ab4be24e +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e1f5e19236dcdd3e73c8b8dedb8e3daf +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e57bae9b7a4c75c1d0c2a3e1c1aae160 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e63e2d8b377101ea8de761b46eb0f50f +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ea25d11b296786fb90debfd6972d97d8 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/ec5a73c71a7a240d83eab2b121328bcd +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/efd49fd3ad186d8dce200e0ca411e35d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f35adec61f96a28e6d188caddee1fd4b +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f5855ddab883d0ee58146d0369cc8227 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f58cd07201e2fffd12f2e1829869c350 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f657dcaacbf72b65af3abd6b22bf68b3 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f91592d9720c5a81657c3198d7d525ac +0 -0
- data/spec/features/admin_login_spec.rb +92 -0
- data/spec/fixtures/users.yml +16 -0
- data/spec/lib/asset_tags_spec.rb +107 -107
- data/spec/lib/frame_grab_spec.rb +17 -17
- data/spec/lib/geometry_transformation_spec.rb +63 -63
- data/spec/rails_helper.rb +73 -0
- data/spec/spec_helper.rb +13 -35
- data/spec/support/custom_actions.rb +9 -0
- data/trusty-clipped-extension.gemspec +1 -1
- metadata +309 -31
- data/spec/ci/before_script +0 -23
- data/spec/ci/script +0 -2
- data/spec/controllers/admin/assets_controller_spec.rb +0 -50
- data/spec/controllers/admin/page_attachments_controller_spec.rb +0 -50
- data/spec/datasets/assets_dataset.rb +0 -36
- data/spec/models/asset_spec.rb +0 -72
- data/spec/models/asset_type_spec.rb +0 -70
- data/spec/models/post_processing_spec.rb +0 -62
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe 'Administration Interface Login' do
|
4
|
+
fixtures :users
|
5
|
+
|
6
|
+
it 'shows a login page' do
|
7
|
+
visit '/'
|
8
|
+
|
9
|
+
expect(page).to have_field 'Username or E-mail Address'
|
10
|
+
expect(page).to have_field 'Password'
|
11
|
+
expect(page).to have_button 'Login'
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'shows an error if the username is wrong' do
|
15
|
+
log_in_as 'nonexistent_username'
|
16
|
+
|
17
|
+
expect(find('#error')).to have_content "Invalid username, e-mail address, or password."
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'as an admin user' do
|
21
|
+
before(:each) do
|
22
|
+
@admin = users(:captain_janeway)
|
23
|
+
end
|
24
|
+
|
25
|
+
context 'after login' do
|
26
|
+
before(:each) do
|
27
|
+
log_in_as @admin.login
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'shows the admin interface' do
|
31
|
+
expect(page).to have_content "Logged in as"
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'has correct links in header' do
|
35
|
+
expect(page).to have_link @admin.name, href: '/admin/preferences/edit'
|
36
|
+
expect(page).to have_link 'Logout', href: '/admin/logout'
|
37
|
+
expect(page).to have_link 'View Site', href: '/'
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'has correct links in navigation' do
|
41
|
+
within '#navigation' do
|
42
|
+
expect(page).to have_link "Content", href: '/admin/pages'
|
43
|
+
expect(page).to have_link "Design", href: '/admin/layouts'
|
44
|
+
expect(page).to have_link "Settings", href: '/admin/configuration'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'outputs table header as html' do
|
49
|
+
expect(page).to have_selector "table#pages th.name"
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
it 'can navigate to create new page' do
|
54
|
+
visit '/admin/pages/new'
|
55
|
+
expect(page).to have_selector "h1", text: "New Page"
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'can log out' do
|
59
|
+
click_link "Logout"
|
60
|
+
expect(page).to have_content "You are now logged out."
|
61
|
+
|
62
|
+
visit '/admin/pages/new'
|
63
|
+
expect(page).to have_content "Please Login"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'shows an error if the password is wrong' do
|
68
|
+
log_in_as @admin.login, 'passwordwhoops'
|
69
|
+
|
70
|
+
expect(find('#error')).to have_content "Invalid username, e-mail address, or password."
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe 'as a regular user after login' do
|
75
|
+
before(:each) do
|
76
|
+
@user = users(:neelix)
|
77
|
+
log_in_as @user.login
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'can log in to the admin interface' do
|
81
|
+
expect(page).to have_content "Logged in as"
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'has correct links in navigation' do
|
85
|
+
within '#navigation' do
|
86
|
+
expect(page).to have_link "Content", href: '/admin/pages'
|
87
|
+
expect(page).not_to have_link "Design"
|
88
|
+
expect(page).to have_link "Settings", href: '/admin/configuration'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Digest::SHA1.hexdigest("--nacl--password--")
|
2
|
+
# => "c4c53733c893f09e30d685322a00ed2394f8b65e"
|
3
|
+
|
4
|
+
captain_janeway:
|
5
|
+
name: 'Kathryn Janeway'
|
6
|
+
login: 'captain'
|
7
|
+
salt: 'nacl'
|
8
|
+
password: 'c4c53733c893f09e30d685322a00ed2394f8b65e' # => 'password'
|
9
|
+
admin: true
|
10
|
+
|
11
|
+
neelix:
|
12
|
+
name: 'Neelix'
|
13
|
+
login: 'neelix'
|
14
|
+
salt: 'nacl'
|
15
|
+
password: 'c4c53733c893f09e30d685322a00ed2394f8b65e' # => 'password'
|
16
|
+
admin: false
|
data/spec/lib/asset_tags_spec.rb
CHANGED
@@ -1,107 +1,107 @@
|
|
1
|
-
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
-
|
3
|
-
describe AssetTags do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
end
|
1
|
+
# require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
#
|
3
|
+
# describe AssetTags do
|
4
|
+
# dataset :assets
|
5
|
+
# let(:page) { pages(:pictured) }
|
6
|
+
# let(:asset) { assets(:test1) }
|
7
|
+
#
|
8
|
+
# context "Asset tags" do
|
9
|
+
# %w{width height caption asset_file_name asset_content_type asset_file_size id filename image flash url link extension page:title page:url}.each do |name|
|
10
|
+
# it "should have the new singular 'asset:#{name}' tag and method" do
|
11
|
+
# page.tags.include?("asset:#{name}").should be_true
|
12
|
+
# page.respond_to?("tag:asset:#{name}".to_sym).should be_true
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# it "should have the old plural 'assets:#{name}' tag and method" do
|
16
|
+
# page.tags.include?("assets:#{name}").should be_true
|
17
|
+
# page.respond_to?("tag:assets:#{name}".to_sym).should be_true
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# it "should deprecate the old plural 'assets:#{name}' tag" do
|
21
|
+
# ActiveSupport::Deprecation.should_receive(:warn).at_least(:once)
|
22
|
+
# page.should render("<r:assets:first><r:assets:#{name} /></r:assets:first>")
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# context "rendering tag" do
|
28
|
+
# before do
|
29
|
+
# TrustyCms.config['assets.create_image_thumbnails?'] = true
|
30
|
+
# TrustyCms.config['assets.thumbnails.image'] = 'normal:size=640x640>|small:size=320x320>'
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
# it "assets:each" do
|
34
|
+
# page.should render('<r:assets:each><r:asset:id />,</r:assets:each>').as( "#{asset_id(:test1)},#{asset_id(:test2)}," )
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# it "assets:first" do
|
38
|
+
# page.should render('<r:assets:first><r:asset:id /></r:assets:first>').as( asset.id.to_s )
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# it "should retrieve an asset by name" do
|
42
|
+
# page.should render('<r:asset:id name="video" />').as( "#{asset_id(:video)}" )
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
# it "asset:name" do
|
46
|
+
# page.should render(%{<r:asset:name id="#{asset_id(:test1)}" />}).as( asset.title )
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# it "asset:filename" do
|
50
|
+
# page.should render(%{<r:asset:filename id="#{asset_id(:test1)}" />}).as( asset.asset_file_name )
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# it "asset:url" do
|
54
|
+
# page.should render(%{<r:asset:url id="#{asset_id(:test1)}" />}).as( asset.thumbnail )
|
55
|
+
# page.should render(%{<r:asset:url size="icon" id="#{asset_id(:test1)}" />}).as( asset.thumbnail('icon') )
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# it "asset:link" do
|
59
|
+
# page.should render(%{<r:asset:link id="#{asset_id(:test1)}" />}).as( %{<a href="#{asset.thumbnail}">#{asset.title}</a>} )
|
60
|
+
# page.should render(%{<r:asset:link size="icon" id="#{asset_id(:test1)}" />}).as( %{<a href="#{asset.thumbnail('icon')}">#{asset.title}</a>} )
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# it "asset:image" do
|
64
|
+
# page.should render(%{<r:asset:image id="#{asset_id(:test1)}" />}).as( %{<img src="#{asset.thumbnail}" alt="#{asset.title}" />} )
|
65
|
+
# page.should render(%{<r:asset:image size="icon" id="#{asset_id(:test1)}" />}).as( %{<img src="#{asset.thumbnail('icon')}" alt="#{asset.title}" />} )
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# it "asset:caption" do
|
69
|
+
# page.should render(%{<r:asset:caption id="#{asset_id(:test1)}" />}).as( asset.caption )
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# it "asset:top_padding" do
|
73
|
+
# page.should render(%{<r:asset:top_padding id="#{asset_id(:test1)}" container="500" />}).as( "229" )
|
74
|
+
# end
|
75
|
+
#
|
76
|
+
# it "asset:top_padding for a specified style" do
|
77
|
+
# page.should render(%{<r:asset:top_padding id="#{asset_id(:test1)}" container="500" size="thumbnail" />}).as( "200" )
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# it "asset:width" do
|
81
|
+
# page.should render(%{<r:asset:width id="#{asset_id(:test1)}" />}).as( "400" )
|
82
|
+
# page.should render(%{<r:asset:width id="#{asset_id(:test1)}" size="icon" />}).as( "42" )
|
83
|
+
# end
|
84
|
+
#
|
85
|
+
# it "asset:height" do
|
86
|
+
# page.should render(%{<r:asset:height id="#{asset_id(:test1)}" container="500" />}).as( "200" )
|
87
|
+
# page.should render(%{<r:asset:height id="#{asset_id(:test1)}" size="icon" />}).as( "42" )
|
88
|
+
# end
|
89
|
+
#
|
90
|
+
# it "asset:orientation" do
|
91
|
+
# page.should render(%{<r:asset:orientation id="#{asset_id(:test1)}" />}).as( "horizontal" )
|
92
|
+
# page.should render(%{<r:asset:orientation id="#{asset_id(:test1)}" size="icon" />}).as( "square" )
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# it "asset:aspect" do
|
96
|
+
# page.should render(%{<r:asset:aspect id="#{asset_id(:test1)}" />}).as( 2.to_f.to_s )
|
97
|
+
# page.should render(%{<r:asset:aspect id="#{asset_id(:test1)}" size="icon" />}).as( 1.to_f.to_s )
|
98
|
+
# end
|
99
|
+
#
|
100
|
+
# it "asset:if_image" do
|
101
|
+
# page.should render(%{<r:asset:if_image name="test1">foo</r:asset:if_image>}).as( "foo" )
|
102
|
+
# page.should render(%{<r:asset:if_image name="video">foo</r:asset:if_image>}).as( "" )
|
103
|
+
# end
|
104
|
+
#
|
105
|
+
# end
|
106
|
+
#
|
107
|
+
# end
|
data/spec/lib/frame_grab_spec.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
-
|
3
|
-
describe Paperclip::FrameGrab do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
1
|
+
# require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
#
|
3
|
+
# describe Paperclip::FrameGrab do
|
4
|
+
# dataset :assets
|
5
|
+
# let(:file) { File.new(File.join( File.dirname(__FILE__), "..", "fixtures", "test.flv")) }
|
6
|
+
# let(:asset) { assets(:video) }
|
7
|
+
#
|
8
|
+
# if TrustyCms.config['assets.create_video_thumbnails?']
|
9
|
+
# context "processing video attachment" do
|
10
|
+
# it "should create png icon and thumbnail"
|
11
|
+
# it "should create jpeg file at configured size"
|
12
|
+
# it "should squish if configured size is specific"
|
13
|
+
# it "should preserve aspect ratio if configured size is >"
|
14
|
+
# it "should resize then crop if configured size is #"
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
# end
|
@@ -1,63 +1,63 @@
|
|
1
|
-
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
-
|
3
|
-
describe Paperclip::Geometry do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
end
|
1
|
+
# require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
#
|
3
|
+
# describe Paperclip::Geometry do
|
4
|
+
# let(:original) { Paperclip::Geometry.new(1200,600) }
|
5
|
+
# let(:small) { Paperclip::Geometry.new(100, 50) }
|
6
|
+
# let(:scaled) {Paperclip::Geometry.new(300, 150) }
|
7
|
+
# let(:incomplete) { Paperclip::Geometry.parse("300x") }
|
8
|
+
# let(:simple) { Paperclip::Geometry.parse("300x200") }
|
9
|
+
# let(:cropper) { Paperclip::Geometry.parse("300x200#") }
|
10
|
+
# let(:if_bigger) { Paperclip::Geometry.parse("300x200>") }
|
11
|
+
# let(:if_smaller) { Paperclip::Geometry.parse("300x200<") }
|
12
|
+
# let(:percentage) { Paperclip::Geometry.parse("25%") }
|
13
|
+
# let(:area) { Paperclip::Geometry.parse("180000@") }
|
14
|
+
#
|
15
|
+
# context "=~" do
|
16
|
+
# it "should compare sizes" do
|
17
|
+
# (original =~ small).should be_false
|
18
|
+
# (original =~ Paperclip::Geometry.new(1200,600)).should be_true
|
19
|
+
# end
|
20
|
+
# it "should ignore modifiers" do
|
21
|
+
# (simple =~ cropper).should be_true
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
# context "==" do
|
25
|
+
# it "should compare sizes and modifiers" do
|
26
|
+
# (original == Paperclip::Geometry.new(1200,600)).should be_true
|
27
|
+
# (simple == cropper).should be_false
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# context "stripping modifier" do
|
32
|
+
# it "should return the same geometry with no modifier" do
|
33
|
+
# cropper.without_modifier.should == simple
|
34
|
+
# if_bigger.without_modifier.should == simple
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# context "calculating thumbnail dimensions" do
|
39
|
+
# it "should raise an exception if called on a partial geometry" do
|
40
|
+
# lambda{incomplete * simple}.should raise_error(Paperclip::TransformationError)
|
41
|
+
# end
|
42
|
+
# it "should not raise an exception if called on a complete geometry" do
|
43
|
+
# lambda{original * simple}.should_not raise_error
|
44
|
+
# end
|
45
|
+
# it "should calculate the result of applying another geometry" do
|
46
|
+
# (original * simple).should == scaled
|
47
|
+
# (original * cropper).should == cropper.without_modifier
|
48
|
+
# (original * if_bigger).should == scaled
|
49
|
+
# (original * if_smaller).should == original
|
50
|
+
# (small * if_smaller).should == scaled
|
51
|
+
# (small * cropper).should == cropper.without_modifier
|
52
|
+
# (original * percentage).should == scaled
|
53
|
+
# (original * area).should == scaled
|
54
|
+
# end
|
55
|
+
# it "should cope with a partial-geometry argument" do
|
56
|
+
# (original * incomplete).should == scaled
|
57
|
+
# end
|
58
|
+
# it "should instantiate a non-geometry argument" do
|
59
|
+
# (original * "300x200").should == scaled
|
60
|
+
# end
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# end
|