alchemy_cms 3.2.0.beta → 3.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +661 -863
- data/README.md +5 -63
- data/app/assets/javascripts/alchemy/alchemy.base.js.coffee +11 -10
- data/app/assets/javascripts/alchemy/alchemy.initializer.js.coffee +6 -0
- data/app/assets/stylesheets/alchemy/_extends.scss +0 -6
- data/app/assets/stylesheets/alchemy/_mixins.scss +6 -0
- data/app/assets/stylesheets/alchemy/buttons.scss +1 -1
- data/app/assets/stylesheets/alchemy/elements.scss +1 -1
- data/app/assets/stylesheets/alchemy/menubar.scss +1 -1
- data/app/assets/stylesheets/alchemy/selects.scss +5 -1
- data/app/assets/stylesheets/alchemy/upload.scss +1 -1
- data/app/controllers/alchemy/admin/pages_controller.rb +1 -1
- data/app/controllers/alchemy/base_controller.rb +4 -57
- data/app/controllers/alchemy/messages_controller.rb +2 -2
- data/app/controllers/alchemy/pages_controller.rb +22 -31
- data/app/controllers/alchemy/pictures_controller.rb +2 -2
- data/app/helpers/alchemy/admin/base_helper.rb +7 -0
- data/app/helpers/alchemy/admin/elements_helper.rb +31 -15
- data/app/helpers/alchemy/admin/pages_helper.rb +17 -0
- data/app/helpers/alchemy/base_helper.rb +0 -28
- data/app/helpers/alchemy/pages_helper.rb +18 -12
- data/app/helpers/alchemy/url_helper.rb +2 -2
- data/app/models/alchemy/cell.rb +1 -1
- data/app/models/alchemy/content/factory.rb +12 -6
- data/app/models/alchemy/element.rb +3 -3
- data/app/models/alchemy/element/definitions.rb +1 -1
- data/app/models/alchemy/element_to_page.rb +7 -0
- data/app/models/alchemy/language.rb +1 -1
- data/app/models/alchemy/page.rb +8 -1
- data/app/models/alchemy/page/page_cells.rb +2 -2
- data/app/models/alchemy/page/page_elements.rb +23 -5
- data/app/models/alchemy/page/page_natures.rb +3 -3
- data/app/models/alchemy/page/page_scopes.rb +1 -1
- data/app/models/alchemy/picture.rb +1 -1
- data/app/views/alchemy/admin/pages/_create_language_form.html.erb +1 -1
- data/app/views/alchemy/admin/pages/_form.html.erb +1 -1
- data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -1
- data/app/views/alchemy/breadcrumb/_page.html.erb +3 -2
- data/app/views/alchemy/breadcrumb/_separator.html.erb +1 -0
- data/app/views/alchemy/breadcrumb/_wrapper.html.erb +13 -0
- data/app/views/alchemy/language_links/_language.html.erb +1 -1
- data/app/views/alchemy/navigation/_link.html.erb +1 -1
- data/app/views/alchemy/pages/show.rss.builder +5 -7
- data/app/views/layouts/alchemy/admin.html.erb +5 -0
- data/config/routes.rb +13 -10
- data/lib/alchemy/configuration_methods.rb +29 -0
- data/lib/alchemy/controller_actions.rb +12 -4
- data/lib/alchemy/engine.rb +3 -0
- data/lib/alchemy/errors.rb +1 -1
- data/lib/alchemy/essence.rb +14 -12
- data/lib/alchemy/on_page_layout.rb +58 -0
- data/lib/alchemy/page_layout.rb +1 -1
- data/lib/alchemy/permissions.rb +21 -16
- data/lib/alchemy/routing_constraints.rb +49 -0
- data/lib/alchemy/seeder.rb +4 -2
- data/lib/alchemy/ssl_protection.rb +30 -0
- data/lib/alchemy/test_support/essence_shared_examples.rb +118 -25
- data/lib/alchemy/test_support/factories.rb +5 -8
- data/lib/alchemy/test_support/integration_helpers.rb +16 -10
- data/lib/alchemy/upgrader/three_point_two.rb +34 -4
- data/lib/alchemy/version.rb +1 -1
- data/lib/rails/generators/alchemy/{scaffold → install}/files/_article_editor.html.erb +0 -0
- data/lib/rails/generators/alchemy/{scaffold → install}/files/_article_view.html.erb +0 -0
- data/lib/rails/generators/alchemy/{scaffold → install}/files/_standard.html.erb +0 -0
- data/lib/rails/generators/alchemy/{scaffold → install}/files/alchemy.de.yml +0 -0
- data/lib/rails/generators/alchemy/{scaffold → install}/files/alchemy.elements.css.scss +0 -0
- data/lib/rails/generators/alchemy/{scaffold → install}/files/alchemy.en.yml +0 -0
- data/lib/rails/generators/alchemy/{scaffold → install}/files/alchemy.es.yml +0 -0
- data/lib/rails/generators/alchemy/{scaffold → install}/files/application.html.erb +0 -0
- data/lib/rails/generators/alchemy/install/install_generator.rb +69 -0
- data/lib/rails/generators/alchemy/{scaffold/files/elements.yml → install/templates/elements.yml.tt} +2 -0
- data/lib/rails/generators/alchemy/{scaffold → install}/templates/page_layouts.yml.tt +2 -0
- data/lib/rails/generators/alchemy/views/views_generator.rb +41 -0
- data/lib/rails/templates/alchemy.rb +2 -2
- data/lib/tasks/alchemy/db.rake +0 -5
- data/lib/tasks/alchemy/install.rake +10 -5
- data/lib/tasks/alchemy/tidy.rake +2 -0
- data/spec/controllers/admin/attachments_controller_spec.rb +1 -1
- data/spec/controllers/admin/clipboard_controller_spec.rb +1 -1
- data/spec/controllers/admin/contents_controller_spec.rb +1 -1
- data/spec/controllers/admin/dashboard_controller_spec.rb +2 -2
- data/spec/controllers/admin/elements_controller_spec.rb +1 -1
- data/spec/controllers/admin/essence_files_controller_spec.rb +1 -1
- data/spec/controllers/admin/essence_pictures_controller_spec.rb +1 -1
- data/spec/controllers/admin/languages_controller_spec.rb +1 -1
- data/spec/controllers/admin/layoutpages_controller_spec.rb +1 -1
- data/spec/controllers/admin/pages_controller_spec.rb +4 -4
- data/spec/controllers/admin/pictures_controller_spec.rb +1 -1
- data/spec/controllers/admin/resources_controller_spec.rb +1 -1
- data/spec/controllers/admin/trash_controller_spec.rb +1 -1
- data/spec/controllers/alchemy/admin/tags_controller_spec.rb +1 -1
- data/spec/controllers/attachments_controller_spec.rb +1 -1
- data/spec/controllers/base_controller_spec.rb +22 -0
- data/spec/controllers/elements_controller_spec.rb +1 -1
- data/spec/controllers/pages_controller_spec.rb +15 -16
- data/spec/controllers/pictures_controller_spec.rb +212 -162
- data/spec/dummy/app/controllers/login_controller.rb +5 -0
- data/spec/dummy/app/models/dummy_model.rb +3 -0
- data/spec/dummy/config/alchemy/cells.yml +4 -1
- data/spec/dummy/config/alchemy/elements.yml +8 -0
- data/spec/dummy/config/alchemy/page_layouts.yml +5 -1
- data/spec/dummy/config/routes.rb +1 -2
- data/spec/dummy/db/migrate/20150412103152_create_dummy_model.rb +7 -0
- data/spec/dummy/db/schema.rb +30 -26
- data/spec/features/admin/dashboard_spec.rb +11 -9
- data/spec/features/admin/language_tree_feature_spec.rb +5 -6
- data/spec/features/admin/legacy_page_url_management_spec.rb +1 -1
- data/spec/features/admin/link_overlay_spec.rb +1 -1
- data/spec/features/admin/locale_select_feature_spec.rb +1 -1
- data/spec/features/admin/modules_integration_spec.rb +1 -1
- data/spec/features/admin/navigation_feature_spec.rb +1 -1
- data/spec/features/admin/page_creation_feature_spec.rb +1 -1
- data/spec/features/admin/page_editing_feature_spec.rb +3 -3
- data/spec/features/admin/picture_library_integration_spec.rb +1 -1
- data/spec/features/admin/resources_integration_spec.rb +1 -1
- data/spec/features/admin/site_select_feature_spec.rb +32 -0
- data/spec/features/admin/tinymce_feature_spec.rb +1 -3
- data/spec/features/page_feature_spec.rb +36 -27
- data/spec/features/security_spec.rb +1 -1
- data/spec/features/translation_integration_spec.rb +3 -3
- data/spec/helpers/admin/elements_helper_spec.rb +103 -26
- data/spec/helpers/admin/pages_helper_spec.rb +32 -1
- data/spec/helpers/base_helper_spec.rb +0 -45
- data/spec/helpers/pages_helper_spec.rb +18 -17
- data/spec/helpers/url_helper_spec.rb +8 -5
- data/spec/libraries/controller_actions_spec.rb +2 -2
- data/spec/libraries/on_page_layout_spec.rb +112 -0
- data/spec/libraries/page_layout_spec.rb +5 -1
- data/spec/libraries/permissions_spec.rb +13 -15
- data/spec/models/cell_spec.rb +4 -0
- data/spec/models/content_spec.rb +6 -0
- data/spec/models/dummy_model_spec.rb +11 -0
- data/spec/models/element_spec.rb +6 -1
- data/spec/models/element_to_page_spec.rb +14 -0
- data/spec/models/page_spec.rb +111 -19
- data/spec/routing/routing_spec.rb +120 -101
- data/spec/spec_helper.rb +3 -3
- metadata +36 -21
- data/app/views/alchemy/breadcrumb/_spacer.html.erb +0 -1
- data/lib/alchemy/capistrano.rb +0 -230
- data/lib/alchemy/test_support/auth_helpers.rb +0 -35
- data/lib/rails/generators/alchemy/deploy_script/deploy_script_generator.rb +0 -90
- data/lib/rails/generators/alchemy/deploy_script/templates/deploy.rb.tt +0 -113
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +0 -63
- data/spec/dummy/app/controllers/errors_controller.rb +0 -5
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Alchemy
|
4
|
+
describe ElementToPage do
|
5
|
+
|
6
|
+
# ClassMethods
|
7
|
+
|
8
|
+
describe '.table_name' do
|
9
|
+
it "should return table name" do
|
10
|
+
expect(ElementToPage.table_name).to eq('alchemy_elements_alchemy_pages')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/models/page_spec.rb
CHANGED
@@ -416,6 +416,26 @@ module Alchemy
|
|
416
416
|
end
|
417
417
|
end
|
418
418
|
|
419
|
+
describe '.ancestors_for' do
|
420
|
+
let(:lang_root) { Page.language_root_for(Language.default.id) }
|
421
|
+
let(:parent) { create(:public_page) }
|
422
|
+
let(:page) { create(:public_page, parent_id: parent.id) }
|
423
|
+
|
424
|
+
it "returns an array of all parents including self" do
|
425
|
+
expect(Page.ancestors_for(page)).to eq([lang_root, parent, page])
|
426
|
+
end
|
427
|
+
|
428
|
+
it "does not include the root page" do
|
429
|
+
expect(Page.ancestors_for(page)).not_to include(Page.root)
|
430
|
+
end
|
431
|
+
|
432
|
+
context "with current page nil" do
|
433
|
+
it "should return an empty array" do
|
434
|
+
expect(Page.ancestors_for(nil)).to eq([])
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
419
439
|
describe '.contentpages' do
|
420
440
|
before do
|
421
441
|
layoutroot = Page.find_or_create_layout_root_for(klingonian.id)
|
@@ -760,7 +780,7 @@ module Alchemy
|
|
760
780
|
describe '#cell_definitions' do
|
761
781
|
before do
|
762
782
|
@page = FactoryGirl.build(:page, page_layout: 'foo')
|
763
|
-
allow(@page).to receive(:
|
783
|
+
allow(@page).to receive(:definition).and_return({'name' => "foo", 'cells' => ["foo_cell"]})
|
764
784
|
@cell_descriptions = [{'name' => "foo_cell", 'elements' => ["1", "2"]}]
|
765
785
|
allow(Cell).to receive(:definitions).and_return(@cell_descriptions)
|
766
786
|
end
|
@@ -770,7 +790,7 @@ module Alchemy
|
|
770
790
|
end
|
771
791
|
|
772
792
|
it "should return empty array if no cells defined in page layout" do
|
773
|
-
allow(@page).to receive(:
|
793
|
+
allow(@page).to receive(:definition).and_return({'name' => "foo"})
|
774
794
|
expect(@page.cell_definitions).to eq([])
|
775
795
|
end
|
776
796
|
end
|
@@ -797,17 +817,6 @@ module Alchemy
|
|
797
817
|
end
|
798
818
|
end
|
799
819
|
|
800
|
-
describe '#element_definitions' do
|
801
|
-
let(:page) { FactoryGirl.build_stubbed(:page) }
|
802
|
-
subject { page.element_definitions }
|
803
|
-
before { expect(Element).to receive(:definitions).and_return([{'name' => 'article'}, {'name' => 'header'}]) }
|
804
|
-
|
805
|
-
it "returns all element definitions that could be placed on current page" do
|
806
|
-
is_expected.to include({'name' => 'article'})
|
807
|
-
is_expected.to include({'name' => 'header'})
|
808
|
-
end
|
809
|
-
end
|
810
|
-
|
811
820
|
describe '#element_definitions_by_name' do
|
812
821
|
let(:page) { FactoryGirl.build_stubbed(:public_page) }
|
813
822
|
|
@@ -835,13 +844,96 @@ module Alchemy
|
|
835
844
|
describe '#element_definition_names' do
|
836
845
|
let(:page) { FactoryGirl.build_stubbed(:public_page) }
|
837
846
|
|
838
|
-
|
839
|
-
|
847
|
+
context "with assigned elements from page and cell definition" do
|
848
|
+
before do
|
849
|
+
allow(page).to receive(:element_names_from_page_definition).and_return(['header', 'article'])
|
850
|
+
allow(page).to receive(:element_names_from_cell_definition).and_return(['search'])
|
851
|
+
end
|
852
|
+
|
853
|
+
it "returns the combined element names" do
|
854
|
+
expect(page.element_definition_names).to eq(%w(header article search))
|
855
|
+
end
|
856
|
+
|
857
|
+
context "when cell definition contains same element name as page definition" do
|
858
|
+
before do
|
859
|
+
allow(page).to receive(:element_names_from_page_definition).and_return(['header', 'article'])
|
860
|
+
allow(page).to receive(:element_names_from_cell_definition).and_return(['header', 'search'])
|
861
|
+
end
|
862
|
+
|
863
|
+
it "returns no duplicates" do
|
864
|
+
expect(page.element_definition_names).to eq(%w(header article search))
|
865
|
+
end
|
866
|
+
end
|
840
867
|
end
|
841
868
|
|
842
|
-
|
843
|
-
|
844
|
-
|
869
|
+
context "without assigned elements from page definition" do
|
870
|
+
before do
|
871
|
+
allow(page).to receive(:element_names_from_page_definition).and_return([])
|
872
|
+
allow(page).to receive(:element_names_from_cell_definition).and_return(['article'])
|
873
|
+
end
|
874
|
+
|
875
|
+
it "returns an array" do
|
876
|
+
expect(page.element_definition_names).to be_an(Array)
|
877
|
+
end
|
878
|
+
end
|
879
|
+
|
880
|
+
context "without assigned elements from cell definition" do
|
881
|
+
before do
|
882
|
+
allow(page).to receive(:element_names_from_page_definition).and_return(['article'])
|
883
|
+
allow(page).to receive(:element_names_from_cell_definition).and_return([])
|
884
|
+
end
|
885
|
+
|
886
|
+
it "returns an array" do
|
887
|
+
expect(page.element_definition_names).to be_an(Array)
|
888
|
+
end
|
889
|
+
end
|
890
|
+
end
|
891
|
+
|
892
|
+
describe "#element_names_from_page_definition" do
|
893
|
+
let(:page) { FactoryGirl.build_stubbed(:public_page) }
|
894
|
+
|
895
|
+
context "with assigned elements from page definition" do
|
896
|
+
before do
|
897
|
+
allow(page).to receive(:definition).and_return(
|
898
|
+
{'name' => 'test_page', 'elements' => ['article']}
|
899
|
+
)
|
900
|
+
end
|
901
|
+
|
902
|
+
it "returns an array of the page's element names" do
|
903
|
+
expect(page.element_names_from_page_definition).to eq(['article'])
|
904
|
+
end
|
905
|
+
end
|
906
|
+
|
907
|
+
context "without assigned elements from page definition" do
|
908
|
+
before do
|
909
|
+
allow(page).to receive(:definition).and_return({})
|
910
|
+
end
|
911
|
+
|
912
|
+
it "returns an array" do
|
913
|
+
expect(page.element_names_from_page_definition).to be_an(Array)
|
914
|
+
end
|
915
|
+
end
|
916
|
+
end
|
917
|
+
|
918
|
+
describe "#element_names_from_cell_definition" do
|
919
|
+
let(:page) { FactoryGirl.build_stubbed(:public_page) }
|
920
|
+
|
921
|
+
context "with assigned elements from cell definition" do
|
922
|
+
before do
|
923
|
+
allow(page).to receive(:cell_definitions).and_return([
|
924
|
+
{'name' => 'header', 'elements' => ['article']}
|
925
|
+
])
|
926
|
+
end
|
927
|
+
|
928
|
+
it "returns an array of the cell's element names" do
|
929
|
+
expect(page.element_names_from_cell_definition).to eq(['article'])
|
930
|
+
end
|
931
|
+
end
|
932
|
+
|
933
|
+
context "without assigned elements from cell definition" do
|
934
|
+
it "returns an array" do
|
935
|
+
expect(page.element_names_from_cell_definition).to be_an(Array)
|
936
|
+
end
|
845
937
|
end
|
846
938
|
end
|
847
939
|
|
@@ -1589,7 +1681,7 @@ module Alchemy
|
|
1589
1681
|
|
1590
1682
|
context 'indicate page editors' do
|
1591
1683
|
let(:page) { Page.new }
|
1592
|
-
let(:user) { create(:
|
1684
|
+
let(:user) { create(:alchemy_dummy_user, :as_editor) }
|
1593
1685
|
|
1594
1686
|
describe '#creator' do
|
1595
1687
|
before { page.update(creator_id: user.id) }
|
@@ -1,142 +1,124 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "The Routing" do
|
4
|
-
|
5
4
|
routes { Alchemy::Engine.routes }
|
6
5
|
|
7
6
|
context "for downloads" do
|
8
|
-
|
9
7
|
it "should have a named route" do
|
10
8
|
expect({
|
11
|
-
:
|
9
|
+
get: "/attachment/32/download/Presseveranstaltung.pdf"
|
12
10
|
}).to route_to(
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
11
|
+
controller: "alchemy/attachments",
|
12
|
+
action: "download",
|
13
|
+
id: "32",
|
14
|
+
name: "Presseveranstaltung",
|
15
|
+
format: "pdf"
|
18
16
|
)
|
19
17
|
end
|
20
|
-
|
21
18
|
end
|
22
19
|
|
23
20
|
describe "nested url" do
|
24
|
-
|
25
21
|
context "one level deep nested" do
|
26
|
-
|
27
22
|
it "should route to pages show" do
|
28
23
|
expect({
|
29
|
-
:
|
24
|
+
get: "/products/my-product"
|
30
25
|
}).to route_to(
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
26
|
+
controller: "alchemy/pages",
|
27
|
+
action: "show",
|
28
|
+
urlname: "products/my-product"
|
34
29
|
)
|
35
30
|
end
|
36
31
|
|
37
32
|
context "and language" do
|
38
|
-
|
39
33
|
it "should route to pages show" do
|
40
34
|
expect({
|
41
|
-
:
|
35
|
+
get: "/de/products/my-product"
|
42
36
|
}).to route_to(
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
37
|
+
controller: "alchemy/pages",
|
38
|
+
action: "show",
|
39
|
+
urlname: "products/my-product",
|
40
|
+
locale: "de"
|
47
41
|
)
|
48
42
|
end
|
49
|
-
|
50
43
|
end
|
51
|
-
|
52
44
|
end
|
53
45
|
|
54
46
|
context "two levels deep nested" do
|
55
|
-
|
56
47
|
it "should route to pages show" do
|
57
48
|
expect({
|
58
|
-
:
|
49
|
+
get: "/catalog/products/my-product"
|
59
50
|
}).to route_to(
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
51
|
+
controller: "alchemy/pages",
|
52
|
+
action: "show",
|
53
|
+
urlname: "catalog/products/my-product"
|
63
54
|
)
|
64
55
|
end
|
65
56
|
|
66
57
|
context "and language" do
|
67
|
-
|
68
58
|
it "should route to pages show" do
|
69
59
|
expect({
|
70
|
-
:
|
60
|
+
get: "/de/catalog/products/my-product"
|
71
61
|
}).to route_to(
|
72
|
-
:
|
73
|
-
:
|
74
|
-
:
|
75
|
-
:
|
62
|
+
controller: "alchemy/pages",
|
63
|
+
action: "show",
|
64
|
+
urlname: "catalog/products/my-product",
|
65
|
+
locale: "de"
|
76
66
|
)
|
77
67
|
end
|
78
|
-
|
79
68
|
end
|
80
|
-
|
81
69
|
end
|
82
70
|
|
83
71
|
context "with a blog date url" do
|
84
|
-
|
85
72
|
it "should route to pages show" do
|
86
73
|
expect({
|
87
|
-
:
|
74
|
+
get: "/2011/12/08/my-post"
|
88
75
|
}).to route_to(
|
89
|
-
:
|
90
|
-
:
|
91
|
-
:
|
76
|
+
controller: "alchemy/pages",
|
77
|
+
action: "show",
|
78
|
+
urlname: "2011/12/08/my-post"
|
92
79
|
)
|
93
80
|
end
|
94
81
|
|
95
82
|
context "and language" do
|
96
|
-
|
97
83
|
it "should route to pages show" do
|
98
84
|
expect({
|
99
|
-
:
|
85
|
+
get: "/de/2011/12/08/my-post"
|
100
86
|
}).to route_to(
|
101
|
-
:
|
102
|
-
:
|
103
|
-
:
|
104
|
-
:
|
87
|
+
controller: "alchemy/pages",
|
88
|
+
action: "show",
|
89
|
+
urlname: "2011/12/08/my-post",
|
90
|
+
locale: "de"
|
105
91
|
)
|
106
92
|
end
|
107
|
-
|
108
93
|
end
|
109
|
-
|
110
94
|
end
|
111
|
-
|
112
95
|
end
|
113
96
|
|
114
97
|
describe "for displaying pictures" do
|
115
|
-
|
116
98
|
it "should route to show action" do
|
117
99
|
expect({
|
118
|
-
:
|
100
|
+
get: "/pictures/3/show/900x300/kitten.jpg"
|
119
101
|
}).to route_to(
|
120
|
-
:
|
121
|
-
:
|
122
|
-
:
|
123
|
-
:
|
124
|
-
:
|
125
|
-
:
|
102
|
+
controller: "alchemy/pictures",
|
103
|
+
action: "show",
|
104
|
+
id: "3",
|
105
|
+
size: "900x300",
|
106
|
+
name: "kitten",
|
107
|
+
format: "jpg"
|
126
108
|
)
|
127
109
|
end
|
128
110
|
|
129
111
|
it "should route to cropped show action" do
|
130
112
|
expect({
|
131
|
-
:
|
113
|
+
get: "/pictures/3/show/900x300/crop/kitten.jpg"
|
132
114
|
}).to route_to(
|
133
|
-
:
|
134
|
-
:
|
135
|
-
:
|
136
|
-
:
|
137
|
-
:
|
138
|
-
:
|
139
|
-
:
|
115
|
+
controller: "alchemy/pictures",
|
116
|
+
action: "show",
|
117
|
+
id: "3",
|
118
|
+
size: "900x300",
|
119
|
+
crop: "crop",
|
120
|
+
name: "kitten",
|
121
|
+
format: "jpg"
|
140
122
|
)
|
141
123
|
end
|
142
124
|
|
@@ -144,15 +126,15 @@ describe "The Routing" do
|
|
144
126
|
expect(get(
|
145
127
|
"/pictures/3/show/300x300/crop/200x50/100x100/kitten.jpg"
|
146
128
|
)).to route_to(
|
147
|
-
:
|
148
|
-
:
|
149
|
-
:
|
150
|
-
:
|
151
|
-
:
|
152
|
-
:
|
153
|
-
:
|
154
|
-
:
|
155
|
-
:
|
129
|
+
controller: "alchemy/pictures",
|
130
|
+
action: "show",
|
131
|
+
id: "3",
|
132
|
+
size: "300x300",
|
133
|
+
crop: "crop",
|
134
|
+
crop_from: "200x50",
|
135
|
+
crop_size: "100x100",
|
136
|
+
name: "kitten",
|
137
|
+
format: "jpg"
|
156
138
|
)
|
157
139
|
end
|
158
140
|
|
@@ -160,12 +142,12 @@ describe "The Routing" do
|
|
160
142
|
expect(get(
|
161
143
|
"/pictures/3/thumbnails/small/kitten.jpg"
|
162
144
|
)).to route_to(
|
163
|
-
:
|
164
|
-
:
|
165
|
-
:
|
166
|
-
:
|
167
|
-
:
|
168
|
-
:
|
145
|
+
controller: "alchemy/pictures",
|
146
|
+
action: "thumbnail",
|
147
|
+
id: "3",
|
148
|
+
size: "small",
|
149
|
+
name: "kitten",
|
150
|
+
format: "jpg"
|
169
151
|
)
|
170
152
|
end
|
171
153
|
|
@@ -173,13 +155,13 @@ describe "The Routing" do
|
|
173
155
|
expect(get(
|
174
156
|
"/pictures/3/thumbnails/small/crop/kitten.jpg"
|
175
157
|
)).to route_to(
|
176
|
-
:
|
177
|
-
:
|
178
|
-
:
|
179
|
-
:
|
180
|
-
:
|
181
|
-
:
|
182
|
-
:
|
158
|
+
controller: "alchemy/pictures",
|
159
|
+
action: "thumbnail",
|
160
|
+
id: "3",
|
161
|
+
crop: "crop",
|
162
|
+
size: "small",
|
163
|
+
name: "kitten",
|
164
|
+
format: "jpg"
|
183
165
|
)
|
184
166
|
end
|
185
167
|
|
@@ -187,14 +169,14 @@ describe "The Routing" do
|
|
187
169
|
expect(get(
|
188
170
|
"/pictures/3/thumbnails/small/0x0/200x200/kitten.jpg"
|
189
171
|
)).to route_to(
|
190
|
-
:
|
191
|
-
:
|
192
|
-
:
|
193
|
-
:
|
194
|
-
:
|
195
|
-
:
|
196
|
-
:
|
197
|
-
:
|
172
|
+
controller: "alchemy/pictures",
|
173
|
+
action: "thumbnail",
|
174
|
+
id: "3",
|
175
|
+
crop_from: "0x0",
|
176
|
+
crop_size: "200x200",
|
177
|
+
size: "small",
|
178
|
+
name: "kitten",
|
179
|
+
format: "jpg"
|
198
180
|
)
|
199
181
|
end
|
200
182
|
|
@@ -202,14 +184,51 @@ describe "The Routing" do
|
|
202
184
|
expect(get(
|
203
185
|
"/pictures/3/zoom/kitten.jpg"
|
204
186
|
)).to route_to(
|
205
|
-
:
|
206
|
-
:
|
207
|
-
:
|
208
|
-
:
|
209
|
-
:
|
187
|
+
controller: "alchemy/pictures",
|
188
|
+
action: "zoom",
|
189
|
+
id: "3",
|
190
|
+
name: "kitten",
|
191
|
+
format: "jpg"
|
210
192
|
)
|
211
193
|
end
|
194
|
+
end
|
212
195
|
|
196
|
+
describe "image format requests" do
|
197
|
+
it "should not be handled by alchemy/pages controller" do
|
198
|
+
expect({
|
199
|
+
get: "/products/my-product.jpg"
|
200
|
+
}).not_to be_routable
|
201
|
+
end
|
213
202
|
end
|
214
203
|
|
204
|
+
describe "unknown formats" do
|
205
|
+
it "should be handled by alchemy/pages controller" do
|
206
|
+
expect({
|
207
|
+
get: "/index.php?id=234"
|
208
|
+
}).to route_to(
|
209
|
+
controller: "alchemy/pages",
|
210
|
+
action: "show",
|
211
|
+
urlname: "index",
|
212
|
+
format: "php",
|
213
|
+
id: "234"
|
214
|
+
)
|
215
|
+
|
216
|
+
expect({
|
217
|
+
get: "/action.do"
|
218
|
+
}).to route_to(
|
219
|
+
controller: "alchemy/pages",
|
220
|
+
action: "show",
|
221
|
+
urlname: "action",
|
222
|
+
format: "do"
|
223
|
+
)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
describe "Rails info requests" do
|
228
|
+
it "should not be handled by alchemy/pages controller" do
|
229
|
+
expect({
|
230
|
+
get: "/rails/info/routes"
|
231
|
+
}).not_to be_routable
|
232
|
+
end
|
233
|
+
end
|
215
234
|
end
|