landable 1.13.1 → 1.13.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rubocop.yml +281 -0
- data/.travis.yml +0 -1
- data/CHANGELOG.md +5 -1
- data/Gemfile +3 -4
- data/README.md +2 -0
- data/Rakefile +6 -3
- data/app/controllers/concerns/landable/variables_concern.rb +9 -9
- data/app/controllers/landable/api/access_tokens_controller.rb +7 -8
- data/app/controllers/landable/api/assets_controller.rb +29 -26
- data/app/controllers/landable/api/audits_controller.rb +6 -5
- data/app/controllers/landable/api/configurations_controller.rb +1 -1
- data/app/controllers/landable/api/directories_controller.rb +2 -2
- data/app/controllers/landable/api/page_revisions_controller.rb +2 -4
- data/app/controllers/landable/api/pages_controller.rb +39 -40
- data/app/controllers/landable/api/template_revisions_controller.rb +1 -2
- data/app/controllers/landable/api/templates_controller.rb +15 -14
- data/app/controllers/landable/api/themes_controller.rb +15 -14
- data/app/controllers/landable/api_controller.rb +10 -11
- data/app/controllers/landable/public/pages_controller.rb +2 -2
- data/app/controllers/landable/public/preview/page_revisions_controller.rb +2 -2
- data/app/controllers/landable/public/preview/pages_controller.rb +1 -1
- data/app/controllers/landable/public/sitemap_controller.rb +2 -2
- data/app/decorators/landable/page_decorator.rb +3 -3
- data/app/helpers/landable/pages_helper.rb +2 -2
- data/app/helpers/landable/traffic_helper.rb +2 -4
- data/app/models/concerns/landable/has_assets.rb +6 -9
- data/app/models/concerns/landable/has_templates.rb +6 -7
- data/app/models/concerns/landable/librarian.rb +5 -5
- data/app/models/concerns/landable/table_name.rb +2 -2
- data/app/models/landable/access_token.rb +1 -1
- data/app/models/landable/asset.rb +8 -8
- data/app/models/landable/asset_search_engine.rb +7 -8
- data/app/models/landable/author.rb +2 -1
- data/app/models/landable/category.rb +1 -3
- data/app/models/landable/directory.rb +2 -2
- data/app/models/landable/page.rb +44 -50
- data/app/models/landable/page_revision.rb +27 -41
- data/app/models/landable/page_search_engine.rb +5 -6
- data/app/models/landable/search_engine.rb +2 -2
- data/app/models/landable/template.rb +9 -11
- data/app/models/landable/template_revision.rb +4 -14
- data/app/models/landable/theme.rb +1 -1
- data/app/models/landable/traffic/attribution.rb +3 -1
- data/app/models/landable/traffic/page_view.rb +1 -1
- data/app/models/landable/traffic/user_agent.rb +1 -1
- data/app/models/landable/traffic/visit.rb +1 -1
- data/app/responders/landable/api_responder.rb +5 -3
- data/app/responders/landable/page_render_responder.rb +1 -1
- data/app/serializers/landable/asset_serializer.rb +1 -1
- data/app/serializers/landable/audit_serializer.rb +2 -3
- data/app/serializers/landable/directory_serializer.rb +2 -2
- data/app/serializers/landable/page_revision_serializer.rb +0 -1
- data/app/serializers/landable/page_serializer.rb +5 -5
- data/app/serializers/landable/template_serializer.rb +2 -2
- data/app/services/landable/authentication_service.rb +1 -1
- data/app/services/landable/registration_service.rb +3 -2
- data/app/services/landable/render_service.rb +16 -18
- data/app/services/landable/screenshot_service.rb +3 -4
- data/app/services/landable/tidy_service.rb +32 -37
- data/app/validators/path_validator.rb +1 -3
- data/app/validators/url_validator.rb +4 -7
- data/config/routes.rb +3 -6
- data/db/migrate/20130510221424_create_landable_schema.rb +45 -56
- data/db/migrate/20130909182713_landable_pages__add_updated_by.rb +2 -2
- data/db/migrate/20130909182715_landable_page_revisions__break_out_snapshot.rb +9 -12
- data/db/migrate/20131002220041_file_based_themes.rb +3 -3
- data/db/migrate/20131008164204_create_head_tag_on_page.rb +4 -4
- data/db/migrate/20131008193544_drop_status_codes_model.rb +1 -2
- data/db/migrate/20131028145652_add_traffic_schema.rb +5 -5
- data/db/migrate/20131101213623_add_dnt_column_to_visits.rb +1 -1
- data/db/migrate/20131106185946_add_index_on_page_revisions_path.rb +1 -1
- data/db/migrate/20131106193021_page_revisisons__path_status_code_index.rb +1 -1
- data/db/migrate/20131121150902_add_attribution_id_to_unique_index.rb +2 -2
- data/db/migrate/20131216214027_drop_browser_screenshot_tables.rb +3 -3
- data/db/migrate/20140128170659_file_backed_templates.rb +1 -1
- data/db/migrate/20140205193757_fix_status_codes.rb +3 -3
- data/db/migrate/20140220170324_add_slug_to_categories.rb +1 -1
- data/db/migrate/20140224205516_rename_traffic_schema.rb +7 -9
- data/db/migrate/20140509190128_create_template_revisions.rb +13 -15
- data/db/migrate/20140509192856_create_audits.rb +3 -3
- data/db/migrate/20140602213937_path_response_time_view.rb +20 -19
- data/features/step_definitions/asset_steps.rb +10 -12
- data/features/step_definitions/core_api_steps.rb +29 -27
- data/features/step_definitions/factory_steps.rb +16 -16
- data/features/step_definitions/html_steps.rb +1 -1
- data/features/step_definitions/liquid_steps.rb +8 -8
- data/features/step_definitions/theme_steps.rb +4 -4
- data/features/support/env.rb +5 -5
- data/landable.gemspec +2 -2
- data/lib/generators/landable/landable_generator.rb +2 -2
- data/lib/generators/templates/landable.rb +1 -1
- data/lib/landable.rb +7 -7
- data/lib/landable/configuration.rb +10 -19
- data/lib/landable/engine.rb +19 -19
- data/lib/landable/error.rb +1 -3
- data/lib/landable/layout.rb +6 -6
- data/lib/landable/liquid/asset_tags.rb +3 -5
- data/lib/landable/liquid/drops.rb +3 -8
- data/lib/landable/liquid/filters.rb +1 -3
- data/lib/landable/liquid/tags.rb +10 -10
- data/lib/landable/migration.rb +30 -30
- data/lib/landable/mime_types.rb +1 -1
- data/lib/landable/partial.rb +2 -2
- data/lib/landable/seeds.rb +3 -4
- data/lib/landable/traffic.rb +4 -8
- data/lib/landable/traffic/tracker.rb +48 -43
- data/lib/landable/traffic/user_tracker.rb +15 -10
- data/lib/landable/version.rb +1 -1
- data/lib/schema_moves.rb +15 -16
- data/lib/tasks/landable/cucumber.rake +46 -47
- data/lib/tasks/landable/data.rake +13 -14
- data/lib/tasks/landable/pgtap.rake +12 -18
- data/lib/tasks/landable/seed.rake +4 -4
- data/spec/concerns/landable/has_assets_spec.rb +15 -19
- data/spec/concerns/landable/has_templates_spec.rb +10 -13
- data/spec/concerns/landable/librarian.rb +4 -4
- data/spec/concerns/landable/table_name_spec.rb +3 -5
- data/spec/concerns/landable/traffic/table_name_spec.rb +2 -4
- data/spec/controllers/concerns/landable/variables_concern_spec.rb +11 -10
- data/spec/controllers/landable/api/assets_controller_spec.rb +15 -14
- data/spec/controllers/landable/api/audits_controller_spec.rb +104 -102
- data/spec/controllers/landable/api/categories_controller_spec.rb +36 -34
- data/spec/controllers/landable/api/configuration_controller_spec.rb +14 -12
- data/spec/controllers/landable/api/directories_controller_spec.rb +52 -50
- data/spec/controllers/landable/api/page_revisions_controller_spec.rb +20 -18
- data/spec/controllers/landable/api/pages_controller_spec.rb +204 -203
- data/spec/controllers/landable/api/template_revisions_controller_spec.rb +20 -18
- data/spec/controllers/landable/api/templates_controller_spec.rb +39 -37
- data/spec/controllers/landable/api_controller_spec.rb +24 -26
- data/spec/controllers/public/preview/page_revisions_controller_spec.rb +36 -34
- data/spec/controllers/public/preview/pages_controller_spec.rb +32 -30
- data/spec/controllers/public/sitemap_controller_spec.rb +19 -17
- data/spec/decorators/page_decorator_spec.rb +9 -9
- data/spec/dummy/app/helpers/application_helper.rb +1 -1
- data/spec/dummy/config/application.rb +5 -6
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/environments/test.rb +1 -1
- data/spec/dummy/config/initializers/landable.rb +7 -6
- data/spec/factories/asset.rb +1 -1
- data/spec/factories/audit.rb +1 -1
- data/spec/factories/authors.rb +1 -1
- data/spec/factories/category.rb +1 -1
- data/spec/factories/pages.rb +4 -4
- data/spec/factories/template.rb +3 -3
- data/spec/factories/theme.rb +2 -2
- data/spec/helpers/pages_helper_spec.rb +5 -5
- data/spec/lib/landable/configuration_spec.rb +2 -4
- data/spec/lib/landable/event_publisher_spec.rb +1 -3
- data/spec/lib/landable/layout_spec.rb +4 -4
- data/spec/lib/landable/liquid_spec.rb +12 -14
- data/spec/lib/landable/migration_spec.rb +4 -4
- data/spec/lib/landable/partial_spec.rb +18 -18
- data/spec/lib/landable/tracking_spec.rb +27 -29
- data/spec/lib/landable/traffic_spec.rb +29 -33
- data/spec/models/landable/access_token_spec.rb +1 -1
- data/spec/models/landable/asset_spec.rb +9 -11
- data/spec/models/landable/directory_spec.rb +7 -7
- data/spec/models/landable/page/errors_spec.rb +1 -3
- data/spec/models/landable/page_revision_spec.rb +23 -24
- data/spec/models/landable/page_spec.rb +41 -42
- data/spec/models/landable/template_revision_spec.rb +3 -3
- data/spec/models/landable/template_spec.rb +11 -11
- data/spec/models/landable/theme_spec.rb +2 -2
- data/spec/models/landable/traffic/referer_spec.rb +3 -3
- data/spec/responders/page_render_responder_spec.rb +0 -2
- data/spec/routing/public_page_route_spec.rb +4 -5
- data/spec/services/landable/authentication_service_spec.rb +7 -7
- data/spec/services/landable/render_service_spec.rb +8 -8
- data/spec/services/landable/screenshot_service_spec.rb +3 -3
- data/spec/services/landable/tidy_service_spec.rb +20 -20
- data/spec/spec_helper.rb +3 -3
- data/spec/support/behaviors.rb +4 -4
- data/spec/support/helpers.rb +1 -1
- metadata +86 -35
- checksums.yaml +0 -7
@@ -1,28 +1,30 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
module Landable
|
4
|
-
|
5
|
-
|
3
|
+
module Landable
|
4
|
+
module Api
|
5
|
+
describe TemplateRevisionsController, json: true do
|
6
|
+
routes { Landable::Engine.routes }
|
6
7
|
|
7
|
-
|
8
|
-
|
8
|
+
describe '#index' do
|
9
|
+
include_examples 'Authenticated API controller', :make_request
|
9
10
|
|
10
|
-
|
11
|
+
let(:template) { create :template }
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
def make_request(template_id = template.id)
|
14
|
+
get :index, template_id: template_id
|
15
|
+
end
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
it "returns all of a template's revisions" do
|
18
|
+
template.publish! author: current_author
|
19
|
+
make_request
|
20
|
+
response.status.should eq 200
|
21
|
+
last_json['template_revisions'].length.should eq 1
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
it '404s on page not found' do
|
25
|
+
make_request random_uuid
|
26
|
+
response.status.should eq 404
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -1,42 +1,44 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
module Landable
|
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
|
-
|
3
|
+
module Landable
|
4
|
+
module Api
|
5
|
+
describe TemplatesController, json: true do
|
6
|
+
routes { Landable::Engine.routes }
|
7
|
+
|
8
|
+
describe '#preview', json: false do
|
9
|
+
include_examples 'Authenticated API controller', :make_request
|
10
|
+
render_views
|
11
|
+
|
12
|
+
let(:theme) { create :theme, body: '<html><head>{% head_content %}</head><body>Theme content; page content: {{body}}</body></html>' }
|
13
|
+
|
14
|
+
before do
|
15
|
+
request.env['HTTP_ACCEPT'] = 'text/html'
|
16
|
+
end
|
17
|
+
|
18
|
+
def make_request(attributes = attributes_for(:template, theme_id: theme.id))
|
19
|
+
post :preview, template: attributes
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'renders JSON' do
|
23
|
+
request.env['HTTP_ACCEPT'] = 'application/json'
|
24
|
+
make_request
|
25
|
+
response.status.should eq 200
|
26
|
+
last_json['template']['preview'].should be_present
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'renders the layout without content if the body is not present' do
|
30
|
+
request.env['HTTP_ACCEPT'] = 'application/json'
|
31
|
+
make_request attributes_for(:page, body: nil)
|
32
|
+
response.status.should eq 200
|
33
|
+
last_json['template']['preview'].should include('body')
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'renders without a layout if no theme is present' do
|
37
|
+
request.env['HTTP_ACCEPT'] = 'application/json'
|
38
|
+
make_request attributes_for(:page, body: 'raw content')
|
39
|
+
response.status.should eq 200
|
40
|
+
last_json['template']['preview'].should include('raw content')
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
42
44
|
end
|
@@ -21,7 +21,7 @@ describe Landable::ApiController, json: true do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def not_found
|
24
|
-
|
24
|
+
fail ActiveRecord::RecordNotFound
|
25
25
|
end
|
26
26
|
|
27
27
|
def xml_only
|
@@ -39,7 +39,7 @@ describe Landable::ApiController, json: true do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def other_pg_error
|
42
|
-
ActiveRecord::Base.connection.execute
|
42
|
+
ActiveRecord::Base.connection.execute 'LOL THIS IS NOT SQL AT ALL GUYS!'
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -70,47 +70,47 @@ describe Landable::ApiController, json: true do
|
|
70
70
|
get :index, params
|
71
71
|
end
|
72
72
|
|
73
|
-
it
|
73
|
+
it 'sets current_author when valid' do
|
74
74
|
make_request
|
75
|
-
controller.send(:current_author).should
|
75
|
+
controller.send(:current_author).should eq author
|
76
76
|
end
|
77
77
|
|
78
|
-
it
|
78
|
+
it 'must be in the HTTP Authorization header' do
|
79
79
|
headers.delete 'HTTP_AUTHORIZATION'
|
80
80
|
make_request access_token: token.id
|
81
|
-
response.status.should
|
81
|
+
response.status.should eq 401
|
82
82
|
end
|
83
83
|
|
84
|
-
it
|
84
|
+
it 'must belong to a valid Author username' do
|
85
85
|
headers['HTTP_AUTHORIZATION'] = encode_basic_auth('wrong-username', token.id)
|
86
86
|
make_request
|
87
|
-
response.status.should
|
87
|
+
response.status.should eq 401
|
88
88
|
end
|
89
89
|
|
90
|
-
it
|
90
|
+
it 'must be an existing token ID' do
|
91
91
|
headers['HTTP_AUTHORIZATION'] = encode_basic_auth(author.username, token.id.reverse)
|
92
92
|
make_request
|
93
|
-
response.status.should
|
93
|
+
response.status.should eq 401
|
94
94
|
end
|
95
95
|
|
96
|
-
it
|
96
|
+
it 'must not be expired' do
|
97
97
|
token.update_attributes(expires_at: 1.minute.ago)
|
98
98
|
make_request
|
99
|
-
response.status.should
|
99
|
+
response.status.should eq 401
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
context 'rescues RecordNotFound' do
|
104
104
|
it 'returns 404 Not Found' do
|
105
105
|
get :not_found
|
106
|
-
response.status.should
|
106
|
+
response.status.should eq 404
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
110
|
context 'rescues RecordInvalid' do
|
111
111
|
it 'returns 422 Unprocessable Entity' do
|
112
112
|
get :record_invalid
|
113
|
-
response.status.should
|
113
|
+
response.status.should eq 422
|
114
114
|
end
|
115
115
|
|
116
116
|
it 'renders ActiveModel::Errors as the JSON response' do
|
@@ -123,20 +123,20 @@ describe Landable::ApiController, json: true do
|
|
123
123
|
it 'returns 406 Not Acceptable' do
|
124
124
|
request.env['HTTP_ACCEPT'] = 'text/plain'
|
125
125
|
get :xml_only
|
126
|
-
response.status.should
|
126
|
+
response.status.should eq 406
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
130
|
context 'rescues PG::Errors about invalid UUIDs' do
|
131
131
|
it 'returns 404' do
|
132
132
|
get :uuid_invalid
|
133
|
-
response.status.should
|
133
|
+
response.status.should eq 404
|
134
134
|
end
|
135
135
|
|
136
136
|
it 're-raises any other PG::Error' do
|
137
|
-
expect
|
137
|
+
expect do
|
138
138
|
get :other_pg_error
|
139
|
-
|
139
|
+
end.to raise_error(PG::Error)
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
@@ -149,13 +149,11 @@ describe Landable::ApiController, json: true do
|
|
149
149
|
get :ok
|
150
150
|
|
151
151
|
# sanity check
|
152
|
-
request.format.symbol.should
|
152
|
+
request.format.symbol.should eq :xml
|
153
153
|
|
154
|
-
controller.api_media.should
|
155
|
-
|
156
|
-
|
157
|
-
param: nil,
|
158
|
-
}
|
154
|
+
controller.api_media.should eq(format: request.format.symbol,
|
155
|
+
version: Landable::VERSION::STRING,
|
156
|
+
param: nil)
|
159
157
|
end
|
160
158
|
end
|
161
159
|
|
@@ -168,8 +166,8 @@ describe Landable::ApiController, json: true do
|
|
168
166
|
|
169
167
|
it 'should set X-Landable-Media-Type' do
|
170
168
|
get :responder
|
171
|
-
response.status.should
|
172
|
-
response.headers['X-Landable-Media-Type'].should
|
169
|
+
response.status.should eq 200
|
170
|
+
response.headers['X-Landable-Media-Type'].should eq "landable.v#{Landable::VERSION::STRING}; format=json"
|
173
171
|
end
|
174
172
|
|
175
173
|
context 'patch' do
|
@@ -1,41 +1,43 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
module Landable
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
3
|
+
module Landable
|
4
|
+
module Public
|
5
|
+
module Preview
|
6
|
+
describe PageRevisionsController do
|
7
|
+
routes { Landable::Engine.routes }
|
8
|
+
|
9
|
+
describe '#show' do
|
10
|
+
let(:author) { create :author }
|
11
|
+
let(:page) { create :page, body: '<p>hello</p>' }
|
12
|
+
let(:page_revision) do
|
13
|
+
page.publish! author: author
|
14
|
+
page.revisions.first
|
15
|
+
end
|
16
|
+
|
17
|
+
before(:each) do
|
18
|
+
# establish the tested-for revision
|
19
|
+
page_revision
|
20
|
+
|
21
|
+
2.times do |i|
|
22
|
+
page.update_attributes! body: "update #{i}"
|
23
|
+
page.publish! author: author
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def make_request
|
28
|
+
get :show, id: page_revision.id
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'renders the page revision' do
|
32
|
+
make_request
|
33
|
+
response.body.should include '<p>hello</p>'
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'is available at /-/pr/:id' do
|
37
|
+
assert_recognizes({ controller: 'landable/public/preview/page_revisions', action: 'show', id: page_revision.id }, "/-/pr/#{page_revision.id}")
|
38
|
+
end
|
23
39
|
end
|
24
40
|
end
|
25
|
-
|
26
|
-
def make_request
|
27
|
-
get :show, id: page_revision.id
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'renders the page revision' do
|
31
|
-
make_request
|
32
|
-
response.body.should include '<p>hello</p>'
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'is available at /-/pr/:id' do
|
36
|
-
assert_recognizes({controller: 'landable/public/preview/page_revisions', action: 'show', id: page_revision.id}, "/-/pr/#{page_revision.id}")
|
37
|
-
end
|
38
|
-
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
@@ -1,36 +1,38 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
module Landable
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
3
|
+
module Landable
|
4
|
+
module Public
|
5
|
+
module Preview
|
6
|
+
describe PagesController do
|
7
|
+
routes { Landable::Engine.routes }
|
8
|
+
|
9
|
+
describe '#show' do
|
10
|
+
let(:page) { create :page, body: '<p>hello</p>' }
|
11
|
+
|
12
|
+
before(:each) do
|
13
|
+
page.publish! author: create(:author)
|
14
|
+
page.update_attributes! body: '<p>why hello there</p>'
|
15
|
+
end
|
16
|
+
|
17
|
+
def make_request
|
18
|
+
get :show, id: page.id
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'renders the page in situ' do
|
22
|
+
make_request
|
23
|
+
response.body.should include '<p>why hello there</p>'
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'renders the preview message' do
|
27
|
+
make_request
|
28
|
+
response.body.should include 'Preview Mode'
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'is available at /-/p/:id' do
|
32
|
+
assert_recognizes({ controller: 'landable/public/preview/pages', action: 'show', id: page.id }, "/-/p/#{page.id}")
|
33
|
+
end
|
34
|
+
end
|
28
35
|
end
|
29
|
-
|
30
|
-
it 'is available at /-/p/:id' do
|
31
|
-
assert_recognizes({controller: 'landable/public/preview/pages', action: 'show', id: page.id}, "/-/p/#{page.id}")
|
32
|
-
end
|
33
|
-
|
34
36
|
end
|
35
37
|
end
|
36
38
|
end
|
@@ -1,25 +1,27 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
module Landable
|
4
|
-
|
5
|
-
|
3
|
+
module Landable
|
4
|
+
module Public
|
5
|
+
describe SitemapController do
|
6
|
+
routes { Landable::Engine.routes }
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
it 'returns a 200 status' do
|
9
|
+
get :index
|
10
|
+
response.status.should == 200
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
it 'returns xml' do
|
14
|
+
get :index
|
15
|
+
response.content_type.should == 'application/xml'
|
16
|
+
end
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
it 'calls generate_sitemap with appropriate arguments' do
|
19
|
+
Landable::Page.should_receive(:generate_sitemap).with(host: 'test.host',
|
20
|
+
protocol: 'https',
|
21
|
+
exclude_categories: ['Testing'],
|
22
|
+
sitemap_additional_paths: ['/terms.html']).and_call_original
|
23
|
+
get :index, format: :xml
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|