archangel 0.0.8 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.jshintrc +1 -1
- data/.reek.yml +42 -0
- data/.rubocop.yml +1 -12
- data/.rubocop_exclude.yml +12 -0
- data/.rubocop_todo.yml +0 -4
- data/.travis.yml +5 -7
- data/Gemfile +12 -14
- data/MIT-LICENSE +1 -1
- data/README.md +1 -1
- data/app/controllers/archangel/application_controller.rb +0 -2
- data/app/controllers/archangel/auth/registrations_controller.rb +12 -0
- data/app/controllers/archangel/backend/assets_controller.rb +10 -259
- data/app/controllers/archangel/backend/collections_controller.rb +5 -214
- data/app/controllers/archangel/backend/entries_controller.rb +25 -239
- data/app/controllers/archangel/backend/pages_controller.rb +11 -261
- data/app/controllers/archangel/backend/profiles_controller.rb +19 -12
- data/app/controllers/archangel/backend/sites_controller.rb +17 -16
- data/app/controllers/archangel/backend/templates_controller.rb +5 -232
- data/app/controllers/archangel/backend/users_controller.rb +10 -260
- data/app/controllers/archangel/backend/widgets_controller.rb +5 -226
- data/app/controllers/archangel/frontend/pages_controller.rb +6 -7
- data/app/controllers/concerns/archangel/actionable_concern.rb +9 -0
- data/app/controllers/concerns/archangel/controllers/backend/resourceful_concern.rb +28 -0
- data/app/controllers/concerns/archangel/controllers/resourceful_concern.rb +258 -0
- data/app/controllers/concerns/archangel/paginatable_concern.rb +2 -0
- data/app/controllers/concerns/archangel/seoable_concern.rb +9 -8
- data/app/models/archangel/metatag.rb +12 -0
- data/app/models/archangel/page.rb +7 -1
- data/app/models/archangel/site.rb +6 -1
- data/app/models/archangel/user.rb +7 -0
- data/app/views/archangel/backend/pages/_form.html.erb +12 -2
- data/app/views/archangel/backend/pages/_metatag_fields.html.erb +6 -0
- data/app/views/archangel/backend/pages/show.html.erb +0 -10
- data/app/views/archangel/backend/profiles/_form.html.erb +2 -0
- data/app/views/archangel/backend/sites/_form.html.erb +11 -2
- data/app/views/archangel/backend/sites/_metatag_fields.html.erb +6 -0
- data/app/views/archangel/backend/sites/show.html.erb +0 -10
- data/app/views/archangel/frontend/pages/show.json.jbuilder +1 -2
- data/archangel.gemspec +18 -11
- data/bin/archangel +6 -4
- data/config/locales/active_record.en.yml +3 -4
- data/config/locales/en.yml +6 -0
- data/db/migrate/20190101220919_add_preferences_to_archangel_users.rb +5 -0
- data/db/migrate/20190113130750_create_archangel_metatags.rb +14 -0
- data/db/migrate/20190113130751_remove_meta_keywords_and_meta_description_from_archangel_pages.rb +6 -0
- data/db/migrate/20190113130752_remove_meta_keywords_and_meta_description_from_archangel_sites.rb +6 -0
- data/docs/Developers.md +2 -2
- data/docs/Extension/Developers.md +1 -1
- data/docs/Extension/Uploaders.md +53 -1
- data/docs/Theme/Developers.md +8 -2
- data/lib/archangel.rb +2 -2
- data/lib/archangel/commands/base_command.rb +35 -0
- data/lib/archangel/commands/extension_command.rb +128 -0
- data/lib/archangel/{command/templates/extension → commands/templates/common}/.editorconfig +0 -0
- data/lib/archangel/{command/templates/extension → commands/templates/common}/.gitignore +0 -0
- data/lib/archangel/{command/templates/extension → commands/templates/common}/.rspec +0 -0
- data/lib/archangel/{command/templates/extension → commands/templates/common}/.rubocop.yml +0 -0
- data/lib/archangel/{command/templates/extension → commands/templates/common}/MIT-LICENSE +0 -0
- data/lib/archangel/{command/templates/extension → commands/templates/common}/spec/rails_helper.rb.tt +0 -3
- data/lib/archangel/{command/templates/extension → commands/templates/common}/spec/spec_helper.rb +0 -0
- data/lib/archangel/{command/templates/extension → commands/templates/common}/spec/support/.keep +0 -0
- data/lib/archangel/{command → commands}/templates/extension/Gemfile +9 -10
- data/lib/archangel/{command → commands}/templates/extension/README.md +0 -0
- data/lib/archangel/{command → commands}/templates/extension/Rakefile +0 -0
- data/lib/archangel/{command → commands}/templates/extension/app/assets/javascripts/archangel/auth/%extension_name%.js.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/app/assets/javascripts/archangel/backend/%extension_name%.js.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/app/assets/javascripts/archangel/frontend/%extension_name%.js.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/app/assets/stylesheets/archangel/auth/%extension_name%.css.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/app/assets/stylesheets/archangel/backend/%extension_name%.css.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/app/assets/stylesheets/archangel/frontend/%extension_name%.css.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/bin/rails.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/config/locales/en.yml.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/config/routes.rb +0 -0
- data/lib/archangel/{command/templates/extension/extension.gemspec → commands/templates/extension/extension.gemspec.tt} +0 -0
- data/lib/archangel/{command → commands}/templates/extension/lib/%extension_name%.rb.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/lib/%extension_name%/engine.rb.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/lib/%extension_name%/factories.rb.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/lib/%extension_name%/version.rb.tt +0 -0
- data/lib/archangel/{command → commands}/templates/extension/lib/generators/%extension_name%/install/install_generator.rb.tt +0 -0
- data/lib/archangel/commands/templates/theme/Gemfile +27 -0
- data/lib/archangel/commands/templates/theme/README.md +44 -0
- data/lib/archangel/commands/templates/theme/Rakefile +29 -0
- data/lib/archangel/commands/templates/theme/app/themes/%theme_base_name%/assets/javascripts/%theme_base_name%/auth.js +2 -0
- data/lib/archangel/commands/templates/theme/app/themes/%theme_base_name%/assets/javascripts/%theme_base_name%/backend.js +2 -0
- data/lib/archangel/commands/templates/theme/app/themes/%theme_base_name%/assets/javascripts/%theme_base_name%/frontend.js +2 -0
- data/lib/archangel/commands/templates/theme/app/themes/%theme_base_name%/assets/stylesheets/%theme_base_name%/auth.css +4 -0
- data/lib/archangel/commands/templates/theme/app/themes/%theme_base_name%/assets/stylesheets/%theme_base_name%/backend.css +4 -0
- data/lib/archangel/commands/templates/theme/app/themes/%theme_base_name%/assets/stylesheets/%theme_base_name%/frontend.css +4 -0
- data/lib/archangel/commands/templates/theme/app/themes/%theme_base_name%/config/locales/en.yml.tt +4 -0
- data/lib/archangel/commands/templates/theme/app/themes/%theme_base_name%/views/layouts/frontend.liquid +18 -0
- data/lib/archangel/commands/templates/theme/bin/rails.tt +11 -0
- data/lib/archangel/commands/templates/theme/lib/%theme_name%.rb.tt +9 -0
- data/lib/archangel/commands/templates/theme/lib/%theme_name%/engine.rb.tt +29 -0
- data/lib/archangel/commands/templates/theme/lib/%theme_name%/version.rb.tt +5 -0
- data/lib/archangel/commands/templates/theme/theme.gemspec.tt +25 -0
- data/lib/archangel/commands/theme_command.rb +129 -0
- data/lib/archangel/config.rb +11 -2
- data/lib/archangel/liquid/drop.rb +26 -0
- data/lib/archangel/liquid/drops/page_drop.rb +1 -1
- data/lib/archangel/liquid/drops/site_drop.rb +1 -1
- data/lib/archangel/liquid/filters/link_to_filter.rb +1 -0
- data/lib/archangel/liquid/tags/application_tag.rb +18 -5
- data/lib/archangel/liquid/tags/collection_tag.rb +1 -1
- data/lib/archangel/liquid/tags/csrf_meta_tags_tag.rb +1 -0
- data/lib/archangel/liquid/tags/locale_tag.rb +1 -0
- data/lib/archangel/liquid/tags/meta_tags_tag.rb +1 -0
- data/lib/archangel/liquid/tags/noembed_tag.rb +140 -0
- data/lib/archangel/liquid/tags/text_direction_tag.rb +1 -0
- data/lib/archangel/liquid/tags/theme_javascript_tag.rb +1 -0
- data/lib/archangel/liquid/tags/theme_stylesheet_tag.rb +1 -0
- data/lib/archangel/testing_support/factories/archangel_assets.rb +2 -2
- data/lib/archangel/testing_support/factories/archangel_collections.rb +1 -1
- data/lib/archangel/testing_support/factories/archangel_entries.rb +1 -1
- data/lib/archangel/testing_support/factories/archangel_fields.rb +4 -4
- data/lib/archangel/testing_support/factories/archangel_metatags.rb +21 -0
- data/lib/archangel/testing_support/factories/archangel_pages.rb +5 -7
- data/lib/archangel/testing_support/factories/archangel_sites.rb +1 -3
- data/lib/archangel/testing_support/factories/archangel_templates.rb +7 -7
- data/lib/archangel/testing_support/factories/archangel_users.rb +10 -10
- data/lib/archangel/testing_support/factories/archangel_widgets.rb +2 -2
- data/lib/archangel/testing_support/matchers/have_meta.rb +18 -0
- data/lib/archangel/testing_support/matchers/have_title.rb +18 -0
- data/lib/archangel/testing_support/rake/dummy_rake.rb +0 -2
- data/lib/archangel/version.rb +1 -1
- data/lib/generators/archangel/install/templates/config/archangel.yml +52 -37
- data/spec/controllers/archangel/backend/entries_controller_spec.rb +3 -3
- data/spec/controllers/archangel/backend/pages_controller_spec.rb +17 -1
- data/spec/controllers/archangel/backend/profiles_controller_spec.rb +1 -1
- data/spec/controllers/archangel/backend/sites_controller_spec.rb +6 -6
- data/spec/controllers/archangel/backend/users_controller_spec.rb +2 -2
- data/spec/controllers/archangel/frontend/pages_controller_spec.rb +2 -6
- data/spec/controllers/concerns/archangel/controllers/backend/resourceful_concern_spec.rb +90 -0
- data/spec/features/auth/registration_spec.rb +18 -0
- data/spec/features/frontend/liquid_drop_variables_spec.rb +51 -57
- data/spec/features/frontend/pages/homepage_redirect_spec.rb +2 -2
- data/spec/features/frontend/pages/metatags_spec.rb +73 -0
- data/spec/helpers/archangel/flash_helper_spec.rb +14 -0
- data/spec/lib/archangel/{command/extension_spec.rb → commands/extension_command_spec.rb} +3 -3
- data/spec/lib/archangel/commands/theme_command_spec.rb +100 -0
- data/spec/lib/archangel/liquid/drops/page_drop_spec.rb +1 -9
- data/spec/lib/archangel/liquid/drops/site_drop_spec.rb +2 -12
- data/spec/lib/archangel/liquid/tags/noembed_tag_spec.rb +76 -0
- data/spec/mailers/archangel/{application_job_spec.rb → application_mailer_spec.rb} +0 -0
- data/spec/models/archangel/metatag_spec.rb +22 -0
- data/spec/models/archangel/page_spec.rb +5 -2
- data/spec/models/archangel/site_spec.rb +2 -0
- data/spec/rails_helper.rb +1 -0
- data/spec/uploaders/archangel/application_uploader_spec.rb +1 -1
- data/spec/uploaders/archangel/asset_uploader_spec.rb +1 -1
- metadata +108 -93
- data/.reek +0 -44
- data/lib/archangel/command/extension.rb +0 -97
data/lib/archangel/version.rb
CHANGED
@@ -1,37 +1,52 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
#
|
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
|
-
|
1
|
+
default: &default
|
2
|
+
# Auth root path.
|
3
|
+
# Default is "account"
|
4
|
+
#
|
5
|
+
auth_path: "account"
|
6
|
+
|
7
|
+
# Allow user registrations.
|
8
|
+
# Default is `false`
|
9
|
+
#
|
10
|
+
allow_registration: false
|
11
|
+
|
12
|
+
# Backend root path.
|
13
|
+
# Default is "backend"
|
14
|
+
#
|
15
|
+
backend_path: "backend"
|
16
|
+
|
17
|
+
# File extension whitelist of asset uploads.
|
18
|
+
# Default is ['gif', 'jpeg', 'jpg', 'png']
|
19
|
+
#
|
20
|
+
asset_extension_whitelist:
|
21
|
+
- gif
|
22
|
+
- jpeg
|
23
|
+
- jpg
|
24
|
+
- png
|
25
|
+
|
26
|
+
# Maximum file size of for asset uploads.
|
27
|
+
# Default is `2097152` (2 Mb) (1024 b * 1024 Kb * 2 Mb)
|
28
|
+
#
|
29
|
+
asset_maximum_file_size: <%= 1024 * 1024 * 2 %>
|
30
|
+
|
31
|
+
# File extension whitelist of general image uploads.
|
32
|
+
# Default is ['gif', 'jpeg', 'jpg', 'png']
|
33
|
+
#
|
34
|
+
image_extension_whitelist:
|
35
|
+
- gif
|
36
|
+
- jpeg
|
37
|
+
- jpg
|
38
|
+
- png
|
39
|
+
|
40
|
+
# Maximum file size of for general image uploads.
|
41
|
+
# # Default is `2097152` (2 Mb) (1024 b * 1024 Kb * 2 Mb)
|
42
|
+
#
|
43
|
+
image_maximum_file_size: <%= 1024 * 1024 * 2 %>
|
44
|
+
|
45
|
+
development:
|
46
|
+
<<: *default
|
47
|
+
|
48
|
+
test:
|
49
|
+
<<: *default
|
50
|
+
|
51
|
+
production:
|
52
|
+
<<: *default
|
@@ -50,7 +50,7 @@ module Archangel
|
|
50
50
|
end
|
51
51
|
|
52
52
|
describe "POST #create" do
|
53
|
-
let
|
53
|
+
let(:collection) { create(:collection) }
|
54
54
|
let!(:field) do
|
55
55
|
create(:field, collection: collection, slug: "slug", required: true)
|
56
56
|
end
|
@@ -137,7 +137,7 @@ module Archangel
|
|
137
137
|
end
|
138
138
|
|
139
139
|
describe "PUT #update" do
|
140
|
-
let
|
140
|
+
let(:collection) { create(:collection) }
|
141
141
|
let!(:field) do
|
142
142
|
create(:field, collection: collection, slug: "slug", required: true)
|
143
143
|
end
|
@@ -240,7 +240,7 @@ module Archangel
|
|
240
240
|
end
|
241
241
|
|
242
242
|
describe "POST #sort" do
|
243
|
-
let
|
243
|
+
let(:collection) { create(:collection) }
|
244
244
|
let!(:field) do
|
245
245
|
create(:field, collection: collection, slug: "slug", required: true)
|
246
246
|
end
|
@@ -45,7 +45,17 @@ module Archangel
|
|
45
45
|
{
|
46
46
|
title: "New Page Title",
|
47
47
|
content: "<p>New page content</p>",
|
48
|
-
slug: "awesome-page"
|
48
|
+
slug: "awesome-page",
|
49
|
+
metatags_attributes: [
|
50
|
+
{
|
51
|
+
name: "description",
|
52
|
+
content: "Description for the Page"
|
53
|
+
},
|
54
|
+
{
|
55
|
+
name: "keywords",
|
56
|
+
content: "keywords,for,the,Page"
|
57
|
+
}
|
58
|
+
]
|
49
59
|
}
|
50
60
|
end
|
51
61
|
|
@@ -55,6 +65,12 @@ module Archangel
|
|
55
65
|
end.to change(Page, :count).by(1)
|
56
66
|
end
|
57
67
|
|
68
|
+
it "creates Metatag resources" do
|
69
|
+
expect do
|
70
|
+
post :create, params: { page: params }
|
71
|
+
end.to change(Metatag, :count).by(2)
|
72
|
+
end
|
73
|
+
|
58
74
|
it "assigns a newly created resource as @page" do
|
59
75
|
post :create, params: { page: params }
|
60
76
|
|
@@ -7,7 +7,7 @@ module Archangel
|
|
7
7
|
RSpec.describe ProfilesController, type: :controller do
|
8
8
|
before { stub_authorization! profile }
|
9
9
|
|
10
|
-
let
|
10
|
+
let(:profile) { create(:user) }
|
11
11
|
|
12
12
|
describe "GET #show" do
|
13
13
|
it "assigns the current user as @profile" do
|
@@ -7,10 +7,10 @@ module Archangel
|
|
7
7
|
RSpec.describe SitesController, type: :controller do
|
8
8
|
before { stub_authorization! profile }
|
9
9
|
|
10
|
-
let
|
10
|
+
let(:site) { create(:site) }
|
11
11
|
|
12
12
|
describe "GET #show" do
|
13
|
-
let
|
13
|
+
let(:profile) { create(:user, :editor, site: site) }
|
14
14
|
|
15
15
|
it "assigns the requested site as @site" do
|
16
16
|
get :show
|
@@ -37,7 +37,7 @@ module Archangel
|
|
37
37
|
|
38
38
|
describe "GET #edit" do
|
39
39
|
context "with permissions" do
|
40
|
-
let
|
40
|
+
let(:profile) { create(:user, :admin, site: site) }
|
41
41
|
|
42
42
|
it "assigns the requested site as @site" do
|
43
43
|
get :edit
|
@@ -47,7 +47,7 @@ module Archangel
|
|
47
47
|
end
|
48
48
|
|
49
49
|
context "without permissions" do
|
50
|
-
let
|
50
|
+
let(:profile) { create(:user, :editor, site: site) }
|
51
51
|
|
52
52
|
it "redirects to site" do
|
53
53
|
get :edit
|
@@ -60,7 +60,7 @@ module Archangel
|
|
60
60
|
|
61
61
|
describe "PUT #update" do
|
62
62
|
context "with permissions" do
|
63
|
-
let
|
63
|
+
let(:profile) { create(:user, :admin, site: site) }
|
64
64
|
|
65
65
|
context "with valid params" do
|
66
66
|
let(:params) do
|
@@ -106,7 +106,7 @@ module Archangel
|
|
106
106
|
end
|
107
107
|
|
108
108
|
context "without permissions" do
|
109
|
-
let
|
109
|
+
let(:profile) { create(:user, :editor, site: site) }
|
110
110
|
|
111
111
|
it "redirects to site" do
|
112
112
|
put :update, params: { site: {} }
|
@@ -7,8 +7,8 @@ module Archangel
|
|
7
7
|
RSpec.describe UsersController, type: :controller do
|
8
8
|
before { stub_authorization! user }
|
9
9
|
|
10
|
-
let
|
11
|
-
let
|
10
|
+
let(:site) { create(:site) }
|
11
|
+
let(:user) { create(:user, site: site) }
|
12
12
|
|
13
13
|
describe "GET #index" do
|
14
14
|
it "assigns all users as @users" do
|
@@ -5,10 +5,10 @@ require "rails_helper"
|
|
5
5
|
module Archangel
|
6
6
|
module Frontend
|
7
7
|
RSpec.describe PagesController, type: :controller do
|
8
|
+
let(:page) { create(:page) }
|
9
|
+
|
8
10
|
describe "loads correct layout" do
|
9
11
|
it "loads correct view" do
|
10
|
-
page = create(:page)
|
11
|
-
|
12
12
|
get :show, params: { path: page.path }
|
13
13
|
|
14
14
|
expect(response).to render_with_layout("frontend")
|
@@ -17,8 +17,6 @@ module Archangel
|
|
17
17
|
|
18
18
|
describe "GET #show" do
|
19
19
|
it "assigns the requested page as @page" do
|
20
|
-
page = create(:page)
|
21
|
-
|
22
20
|
get :show, params: { path: page.path }
|
23
21
|
|
24
22
|
expect(response.content_type).to eq "text/html"
|
@@ -26,8 +24,6 @@ module Archangel
|
|
26
24
|
end
|
27
25
|
|
28
26
|
it "assigns the requested page as @page for JSON request" do
|
29
|
-
page = create(:page)
|
30
|
-
|
31
27
|
get :show, params: { path: page.path }, format: :json
|
32
28
|
|
33
29
|
expect(response.content_type).to eq "application/json"
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails_helper"
|
4
|
+
|
5
|
+
module Archangel
|
6
|
+
RSpec.describe BackendController, type: :controller do
|
7
|
+
before { stub_authorization! }
|
8
|
+
|
9
|
+
controller do
|
10
|
+
include Archangel::Controllers::Backend::ResourcefulConcern
|
11
|
+
include Archangel::SkipAuthorizableConcern
|
12
|
+
|
13
|
+
def location_after_save
|
14
|
+
backend_root_path
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "GET #index" do
|
19
|
+
it "assigns all resources as empty array" do
|
20
|
+
get :index, format: :json
|
21
|
+
|
22
|
+
expect(JSON.parse(response.body)).to eq([])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "GET #show" do
|
27
|
+
it "assigns the requested resource as blank" do
|
28
|
+
get :show, params: { id: 1 }
|
29
|
+
|
30
|
+
expect(response.body).to eq("")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "GET #new" do
|
35
|
+
it "assigns a new resource as nil" do
|
36
|
+
get :new
|
37
|
+
|
38
|
+
expect(assigns(:backend)).to be_nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "POST #create" do
|
43
|
+
context "with params" do
|
44
|
+
let(:params) do
|
45
|
+
{
|
46
|
+
foo: "bar"
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
it "redirects after creating resource" do
|
51
|
+
post :create, params: { backend: params }
|
52
|
+
|
53
|
+
expect(response).to redirect_to(backend_root_path)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe "GET #edit" do
|
59
|
+
it "assigns the requested resource as blank" do
|
60
|
+
get :edit, params: { id: 1 }
|
61
|
+
|
62
|
+
expect(response.body).to eq("")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "PUT #update" do
|
67
|
+
context "with valid params" do
|
68
|
+
let(:params) do
|
69
|
+
{
|
70
|
+
foo: "bar"
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
it "redirects after updating resource" do
|
75
|
+
put :update, params: { id: 1, backend: params }
|
76
|
+
|
77
|
+
expect(response).to redirect_to(backend_root_path)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "DELETE #destroy" do
|
83
|
+
it "redirects to the listing" do
|
84
|
+
delete :destroy, params: { id: 1 }
|
85
|
+
|
86
|
+
expect(response).to redirect_to(backend_root_path)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -23,5 +23,23 @@ RSpec.feature "Auth registration", type: :feature do
|
|
23
23
|
expect(page).to have_selector("input[type=text][id='user_name']")
|
24
24
|
expect(page).to have_selector("input[type=text][id='user_username']")
|
25
25
|
end
|
26
|
+
|
27
|
+
it "allows successful registration" do
|
28
|
+
allow(Archangel.config).to receive(:allow_registration) { true }
|
29
|
+
|
30
|
+
create(:page, homepage: true, content: "Welcome to the homepage")
|
31
|
+
|
32
|
+
visit archangel.new_user_registration_path
|
33
|
+
|
34
|
+
fill_in "Name", with: "John Doe"
|
35
|
+
fill_in "Username", with: "john_doe"
|
36
|
+
fill_in "Email", with: "me@example.com"
|
37
|
+
fill_in "Password", with: "password"
|
38
|
+
fill_in "Confirm Password", with: "password"
|
39
|
+
|
40
|
+
click_button "Sign up"
|
41
|
+
|
42
|
+
expect(page).to have_content("Welcome to the homepage")
|
43
|
+
end
|
26
44
|
end
|
27
45
|
end
|
@@ -3,33 +3,29 @@
|
|
3
3
|
require "rails_helper"
|
4
4
|
|
5
5
|
RSpec.feature "Default variables", type: :feature do
|
6
|
-
|
7
|
-
let(:site) { create(:site) }
|
6
|
+
let(:site) { create(:site) }
|
8
7
|
|
8
|
+
describe "for `current_page`" do
|
9
9
|
it "knows the current page at root level" do
|
10
|
-
content =
|
11
|
-
Current Page: {{ current_page }}
|
12
|
-
CONTENT
|
10
|
+
content = "Current Page: {{ current_page }}"
|
13
11
|
|
14
|
-
|
12
|
+
resource = create(:page, site: site, slug: "foo", content: content)
|
15
13
|
|
16
|
-
visit archangel.frontend_page_path(
|
14
|
+
visit archangel.frontend_page_path(resource.path)
|
17
15
|
|
18
16
|
expect(page).to have_content("Current Page: /foo")
|
19
17
|
end
|
20
18
|
|
21
19
|
it "knows the current page at child level" do
|
22
|
-
content =
|
23
|
-
Current Page: {{ current_page }}
|
24
|
-
CONTENT
|
20
|
+
content = "Current Page: {{ current_page }}"
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
parent_resource = create(:page, site: site, slug: "foo")
|
23
|
+
resource = create(:page, site: site,
|
24
|
+
parent: parent_resource,
|
25
|
+
slug: "bar",
|
26
|
+
content: content)
|
31
27
|
|
32
|
-
visit CGI.unescape(archangel.frontend_page_path(
|
28
|
+
visit CGI.unescape(archangel.frontend_page_path(resource.path))
|
33
29
|
|
34
30
|
expect(page).to have_content("Current Page: /foo/bar")
|
35
31
|
end
|
@@ -37,9 +33,9 @@ RSpec.feature "Default variables", type: :feature do
|
|
37
33
|
it "knows it is on the current page" do
|
38
34
|
content = <<-CONTENT
|
39
35
|
{% if current_page == page.path %}
|
40
|
-
|
36
|
+
Current Page?: Yup!
|
41
37
|
{% else %}
|
42
|
-
|
38
|
+
Current Page?: Nope!
|
43
39
|
{% endif %}
|
44
40
|
CONTENT
|
45
41
|
|
@@ -47,16 +43,16 @@ RSpec.feature "Default variables", type: :feature do
|
|
47
43
|
|
48
44
|
visit archangel.frontend_page_path(post.path)
|
49
45
|
|
50
|
-
expect(page).to have_content("
|
51
|
-
expect(page).not_to have_content("
|
46
|
+
expect(page).to have_content("Current Page?: Yup!")
|
47
|
+
expect(page).not_to have_content("Current Page?: Nope!")
|
52
48
|
end
|
53
49
|
|
54
50
|
it "knows it is not on the current page" do
|
55
51
|
content = <<-CONTENT
|
56
52
|
{% if current_page == '/some-other-page' %}
|
57
|
-
|
53
|
+
Current Page?: Yup!
|
58
54
|
{% else %}
|
59
|
-
|
55
|
+
Current Page?: Nope!
|
60
56
|
{% endif %}
|
61
57
|
CONTENT
|
62
58
|
|
@@ -64,74 +60,72 @@ RSpec.feature "Default variables", type: :feature do
|
|
64
60
|
|
65
61
|
visit archangel.frontend_page_path(post.path)
|
66
62
|
|
67
|
-
expect(page).not_to have_content("
|
68
|
-
expect(page).to have_content("
|
63
|
+
expect(page).not_to have_content("Current Page?: Yup!")
|
64
|
+
expect(page).to have_content("Current Page?: Nope!")
|
69
65
|
end
|
70
|
-
end
|
71
66
|
|
72
|
-
|
73
|
-
|
67
|
+
it "knows the current page with all known slug characters" do
|
68
|
+
slug = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
69
|
+
content = "Current Page: {{ current_page }}"
|
70
|
+
|
71
|
+
resource = create(:page, site: site, slug: slug, content: content)
|
72
|
+
|
73
|
+
visit archangel.frontend_page_path(resource.path)
|
74
|
+
|
75
|
+
expect(page).to have_content("Current Page: /#{slug}")
|
76
|
+
end
|
77
|
+
end
|
74
78
|
|
75
|
-
|
79
|
+
describe "for `page`" do
|
80
|
+
it "knows the `page` properties" do
|
76
81
|
content = <<-CONTENT
|
77
82
|
Page ID: {{ page.id }}
|
78
83
|
Page Title: {{ page.title }}
|
79
84
|
Page Path: {{ page.path }}
|
80
|
-
Page Meta Keywords: {{ page.meta_keywords }}
|
81
|
-
Page Meta Description: {{ page.meta_description }}
|
82
85
|
Page Published At: {{ page.published_at }}
|
86
|
+
Page Unknown: ~{{ page.unknown_variable }}~
|
83
87
|
CONTENT
|
84
88
|
|
85
|
-
|
89
|
+
resource = create(:page, site: site, content: content)
|
86
90
|
|
87
|
-
visit archangel.frontend_page_path(
|
91
|
+
visit archangel.frontend_page_path(resource.path)
|
88
92
|
|
89
|
-
expect(page).to have_content("Page ID: #{
|
90
|
-
expect(page).to have_content("Page Title: #{
|
91
|
-
expect(page).to have_content("Page Path: /#{
|
92
|
-
expect(page).to have_content("Page Meta Keywords: #{post.meta_keywords}")
|
93
|
+
expect(page).to have_content("Page ID: #{resource.id}")
|
94
|
+
expect(page).to have_content("Page Title: #{resource.title}")
|
95
|
+
expect(page).to have_content("Page Path: /#{resource.path}")
|
93
96
|
expect(page)
|
94
|
-
.to have_content("Page
|
95
|
-
expect(page).to have_content("Page
|
97
|
+
.to have_content("Page Published At: #{resource.published_at}")
|
98
|
+
expect(page).to have_content("Page Unknown: ~~")
|
96
99
|
end
|
97
100
|
end
|
98
101
|
|
99
|
-
describe "for site" do
|
100
|
-
|
101
|
-
|
102
|
-
it "knows the site properties" do
|
102
|
+
describe "for `site`" do
|
103
|
+
it "knows the `site` properties" do
|
103
104
|
content = <<-CONTENT
|
104
105
|
Site Name: {{ site.name }}
|
105
106
|
Site Locale: {{ site.locale }}
|
106
|
-
Site Meta Keywords: {{ site.meta_keywords }}
|
107
|
-
Site Meta Description: {{ site.meta_description }}
|
108
107
|
Site Logo: {{ site.logo }}
|
108
|
+
Site Unknown: ~{{ site.unknown_variable }}~
|
109
109
|
CONTENT
|
110
110
|
|
111
|
-
|
111
|
+
resource = create(:page, site: site, content: content)
|
112
112
|
|
113
|
-
visit archangel.frontend_page_path(
|
113
|
+
visit archangel.frontend_page_path(resource.path)
|
114
114
|
|
115
115
|
expect(page).to have_content("Site Name: #{site.name}")
|
116
116
|
expect(page).to have_content("Site Locale: #{site.locale}")
|
117
|
-
expect(page).to have_content("Site Meta Keywords: #{site.meta_keywords}")
|
118
|
-
expect(page)
|
119
|
-
.to have_content("Site Meta Description: #{site.meta_description}")
|
120
117
|
expect(page).to have_content("Site Logo: #{site.logo}")
|
118
|
+
expect(page).to have_content("Site Unknown: ~~")
|
121
119
|
end
|
122
120
|
end
|
123
121
|
|
124
|
-
describe "for unknown variable" do
|
125
|
-
let(:site) { create(:site) }
|
126
|
-
|
122
|
+
describe "for general unknown variable" do
|
127
123
|
it "responds with blank value" do
|
128
|
-
content =
|
129
|
-
Unknown Variable: ~{{ unknown_variable }}~
|
130
|
-
CONTENT
|
124
|
+
content = "Unknown Variable: ~{{ unknown_variable }}~"
|
131
125
|
|
132
|
-
|
126
|
+
resource = create(:page, site: site, content: content)
|
133
127
|
|
134
|
-
visit archangel.frontend_page_path(
|
128
|
+
visit archangel.frontend_page_path(resource.path)
|
135
129
|
|
136
130
|
expect(page).to have_content("Unknown Variable: ~~")
|
137
131
|
end
|