landable 1.13.1 → 1.13.2

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