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
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  module Landable
4
4
  describe Page do
5
5
  it { should be_a HasAssets }
6
- it { should_not have_valid(:status_code).when(nil,'') }
6
+ it { should_not have_valid(:status_code).when(nil, '') }
7
7
  it { should have_valid(:status_code).when(200, 301, 302, 410) }
8
8
  it { should_not have_valid(:status_code).when(201, 303, 405, 500, 404) }
9
9
 
@@ -14,7 +14,7 @@ module Landable
14
14
  context 'PathValidator' do
15
15
  it { should_not have_valid(:path).when(nil, '', '/reserved_path_set_in_initializer') }
16
16
  it { should_not have_valid(:path).when('/reject/this', '/admin', '/ADMIN', '/admin_something' '/admin/path') }
17
- it { should have_valid(:path).when('/reserved_path_set_in_initializer_not', '/do/not/reject/path', '/', '/rejectwhatever', '/reject') }
17
+ it { should have_valid(:path).when('/reserved_path_set_in_initializer_not', '/do/not/reject/path', '/', '/rejectwhatever', '/reject') }
18
18
  end
19
19
 
20
20
  it 'should set is_publishable to true on before_save' do
@@ -23,9 +23,9 @@ module Landable
23
23
  page.is_publishable.should be_true
24
24
  end
25
25
 
26
- specify "#redirect?" do
26
+ specify '#redirect?' do
27
+ Page.new.should_not be_redirect
27
28
  Page.new.should_not be_redirect
28
- Page.new().should_not be_redirect
29
29
  Page.new(status_code: 200).should_not be_redirect
30
30
  Page.new(status_code: 410).should_not be_redirect
31
31
 
@@ -52,33 +52,33 @@ module Landable
52
52
 
53
53
  specify '#path_extension' do
54
54
  Page.new(path: 'foo').path_extension.should be_nil
55
- Page.new(path: 'foo.bar').path_extension.should == 'bar'
56
- Page.new(path: 'foo.bar.baz').path_extension.should == 'baz'
55
+ Page.new(path: 'foo.bar').path_extension.should eq 'bar'
56
+ Page.new(path: 'foo.bar.baz').path_extension.should eq 'baz'
57
57
  Page.new(path: 'foo.bar-baz').path_extension.should be_nil
58
58
  end
59
59
 
60
60
  describe '#content_type' do
61
- def content_type_for path
61
+ def content_type_for(path)
62
62
  Page.new(path: path).content_type
63
63
  end
64
64
 
65
65
  it 'should be text/html for html pages' do
66
- content_type_for('asdf').should == 'text/html'
67
- content_type_for('asdf.htm').should == 'text/html'
68
- content_type_for('asdf.html').should == 'text/html'
66
+ content_type_for('asdf').should eq 'text/html'
67
+ content_type_for('asdf.htm').should eq 'text/html'
68
+ content_type_for('asdf.html').should eq 'text/html'
69
69
  end
70
70
 
71
71
  it 'should be application/json for json' do
72
- content_type_for('asdf.json').should == 'application/json'
72
+ content_type_for('asdf.json').should eq 'application/json'
73
73
  end
74
74
 
75
75
  it 'should be application/xml for xml' do
76
- content_type_for('asdf.xml').should == 'application/xml'
76
+ content_type_for('asdf.xml').should eq 'application/xml'
77
77
  end
78
78
 
79
79
  it 'should be text/plain for everything else' do
80
- content_type_for('foo.bar').should == 'text/plain'
81
- content_type_for('foo.txt').should == 'text/plain'
80
+ content_type_for('foo.bar').should eq 'text/plain'
81
+ content_type_for('foo.txt').should eq 'text/plain'
82
82
  end
83
83
  end
84
84
 
@@ -112,17 +112,17 @@ module Landable
112
112
  describe '#meta_tags' do
113
113
  it { subject.should have_valid(:meta_tags).when(nil) }
114
114
 
115
- specify "quacks like a Hash" do
115
+ specify 'quacks like a Hash' do
116
116
  # Note the change from symbol to string; thus, always favor strings.
117
117
  page = create :page, meta_tags: { keywords: 'foo' }
118
118
 
119
119
  # rails 4.0 preserves the symbol for this instance; rails 4.1 switches straight to strings
120
- page.meta_tags.keys.map(&:to_s).should == ['keywords']
120
+ page.meta_tags.keys.map(&:to_s).should eq ['keywords']
121
121
 
122
122
  tags = Page.first.meta_tags
123
123
  tags.should be_a(Enumerable)
124
- tags.keys.should == ['keywords']
125
- tags.values.should == ['foo']
124
+ tags.keys.should eq ['keywords']
125
+ tags.values.should eq ['foo']
126
126
  end
127
127
  end
128
128
 
@@ -131,23 +131,23 @@ module Landable
131
131
 
132
132
  it 'works as a basic text area' do
133
133
  page = create :page, head_content: "<head en='en'/>"
134
- page.head_content.should == "<head en='en'/>"
135
-
134
+ page.head_content.should eq "<head en='en'/>"
135
+
136
136
  page.head_content = "<head en='magic'/>"
137
137
  page.save
138
138
 
139
- page.head_content.should == "<head en='magic'/>"
139
+ page.head_content.should eq "<head en='magic'/>"
140
140
  end
141
141
  end
142
142
 
143
143
  describe '#path=' do
144
144
  it 'ensures a leading "/" on path' do
145
- Page.new(path: 'foo/bar').path.should == '/foo/bar'
145
+ Page.new(path: 'foo/bar').path.should eq '/foo/bar'
146
146
  end
147
147
 
148
148
  it 'leaves nil and empty paths alone' do
149
- Page.new(path: '').path.should == ''
150
- Page.new(path: nil).path.should == nil
149
+ Page.new(path: '').path.should eq ''
150
+ Page.new(path: nil).path.should.nil?
151
151
  end
152
152
  end
153
153
 
@@ -156,21 +156,21 @@ module Landable
156
156
  let(:author) { FactoryGirl.create :author }
157
157
 
158
158
  it 'should create a page_revision' do
159
- expect {page.publish!(author: author)}.to change{page.revisions.count}.from(0).to(1)
159
+ expect { page.publish!(author: author) }.to change { page.revisions.count }.from(0).to(1)
160
160
  end
161
161
 
162
162
  it 'should have the provided author' do
163
163
  page.publish! author: author
164
164
  revision = page.revisions.last
165
165
 
166
- revision.author.should == author
166
+ revision.author.should eq author
167
167
  end
168
168
 
169
169
  it 'should update the published_revision_id' do
170
170
  page.publish! author: author
171
171
  revision = page.revisions.last
172
172
 
173
- page.published_revision.should == revision
173
+ page.published_revision.should eq revision
174
174
  end
175
175
 
176
176
  it 'should set is_publishable to false' do
@@ -201,7 +201,7 @@ module Landable
201
201
 
202
202
  page.revert_to! revision
203
203
 
204
- page.published_revision.id.should_not == revision.id
204
+ page.published_revision.id.should_not eq revision.id
205
205
  end
206
206
 
207
207
  it 'should copy revision attributes into the page model' do
@@ -232,7 +232,7 @@ module Landable
232
232
  expect { page.save! }.to raise_error
233
233
 
234
234
  page.reload
235
- page.path.should == '/test'
235
+ page.path.should eq '/test'
236
236
  end
237
237
  end
238
238
 
@@ -241,7 +241,7 @@ module Landable
241
241
  page = build :page, path: '/test'
242
242
  page.save!
243
243
 
244
- page.path.should == '/test'
244
+ page.path.should eq '/test'
245
245
  end
246
246
  end
247
247
  end
@@ -250,7 +250,7 @@ module Landable
250
250
  it 'should return the preview path' do
251
251
  page = build :page
252
252
  page.should_receive(:public_preview_page_path) { 'foo' }
253
- page.preview_path.should == 'foo'
253
+ page.preview_path.should eq 'foo'
254
254
  end
255
255
  end
256
256
 
@@ -258,22 +258,22 @@ module Landable
258
258
  it 'should return the preview url' do
259
259
  page = build :page
260
260
  page.should_receive(:public_preview_page_url) { 'foo' }
261
- page.preview_url.should == 'foo'
261
+ page.preview_url.should eq 'foo'
262
262
  end
263
263
  end
264
264
 
265
265
  describe '::sitemappable' do
266
- let(:page) {
266
+ let(:page) do
267
267
  create :page do |page|
268
268
  page.publish! author: create(:author), notes: 'yo'
269
269
  end
270
- }
270
+ end
271
271
  let(:page_2) { create :page, :redirect }
272
272
  let(:page_3) { create :page, meta_tags: { 'robots' => 'noindex' } }
273
273
  let(:page_4) { create :page }
274
274
 
275
- it 'only returns published pages with a status code of 200 and dont have a noindex tag' do
276
- page_2.status_code.should == 301
275
+ it 'only returns published pages with a status code of 200 and dont have a noindex tag' do
276
+ page_2.status_code.should eq 301
277
277
 
278
278
  Landable::Page.sitemappable.should include(page)
279
279
  Landable::Page.sitemappable.should_not include(page_2, page_3, page_4)
@@ -284,13 +284,13 @@ module Landable
284
284
  it 'should force a path to be lowercase' do
285
285
  page = build :page, path: '/SEO'
286
286
  page.should be_valid
287
- page.path.should == '/seo'
287
+ page.path.should eq '/seo'
288
288
  end
289
289
 
290
290
  it 'doesnt change a downcase path' do
291
291
  page = build :page, path: '/seo'
292
292
  page.should be_valid
293
- page.path.should == '/seo'
293
+ page.path.should eq '/seo'
294
294
  end
295
295
  end
296
296
 
@@ -322,7 +322,6 @@ module Landable
322
322
  @page.redirect_url = 'hdasdfpou'
323
323
  @page.should_not be_valid
324
324
  end
325
-
326
325
  end
327
326
  end
328
327
 
@@ -360,14 +359,14 @@ module Landable
360
359
  Landable::Page.generate_sitemap(host: 'example.com',
361
360
  protocol: 'https',
362
361
  exclude_categories: [],
363
- sitemap_additional_paths: ['/terms.html']).should include("<loc>https://example.com/terms.html</loc>")
362
+ sitemap_additional_paths: ['/terms.html']).should include('<loc>https://example.com/terms.html</loc>')
364
363
  end
365
364
  end
366
365
 
367
366
  describe '::by_path' do
368
367
  it 'returns first page with path name' do
369
368
  page = create :page, path: '/seo'
370
- Landable::Page.by_path('/seo').should == page
369
+ Landable::Page.by_path('/seo').should eq page
371
370
  end
372
371
  end
373
372
 
@@ -384,7 +383,7 @@ module Landable
384
383
  page.body = 'body'
385
384
  page.should be_valid
386
385
  page.save!
387
- page.body.should == 'body'
386
+ page.body.should eq 'body'
388
387
  end
389
388
  end
390
389
  end
@@ -5,7 +5,7 @@ module Landable
5
5
  let(:author) { create(:author) }
6
6
 
7
7
  let(:template) do
8
- create(:template, name: 'Title', body: 'body',
8
+ create(:template, name: 'Title', body: 'body',
9
9
  slug: 'title', description: 'awesome template')
10
10
  end
11
11
 
@@ -26,9 +26,9 @@ module Landable
26
26
  revision.template_id = template.id
27
27
  revision.author_id = author.id
28
28
  revision.unpublish!
29
- revision.is_published.should == false
29
+ revision.is_published.should eq false
30
30
  revision.publish!
31
- revision.is_published.should == true
31
+ revision.is_published.should eq true
32
32
  end
33
33
  end
34
34
  end
@@ -17,8 +17,8 @@ module Landable
17
17
  it 'should assign a slug' do
18
18
  template = build(:template, slug: nil)
19
19
  template.name = 'Six Seven'
20
- template.name.should == 'Six Seven'
21
- template.slug.should == 'six_seven'
20
+ template.name.should eq 'Six Seven'
21
+ template.slug.should eq 'six_seven'
22
22
  end
23
23
  end
24
24
 
@@ -26,8 +26,8 @@ module Landable
26
26
  it 'should leave the slug alone' do
27
27
  template = build(:template, slug: 'six')
28
28
  template.name = 'seven'
29
- template.name.should == 'seven'
30
- template.slug.should == 'six'
29
+ template.name.should eq 'seven'
30
+ template.slug.should eq 'six'
31
31
  end
32
32
  end
33
33
  end
@@ -49,21 +49,21 @@ module Landable
49
49
  let(:author) { FactoryGirl.create :author }
50
50
 
51
51
  it 'should create a template_revision' do
52
- expect {template.publish!(author: author)}.to change{template.revisions.count}.from(0).to(1)
52
+ expect { template.publish!(author: author) }.to change { template.revisions.count }.from(0).to(1)
53
53
  end
54
54
 
55
55
  it 'should have the provided author' do
56
56
  template.publish! author: author
57
57
  revision = template.revisions.last
58
58
 
59
- revision.author.should == author
59
+ revision.author.should eq author
60
60
  end
61
61
 
62
62
  it 'should update the published_revision_id' do
63
63
  template.publish! author: author
64
64
  revision = template.revisions.last
65
65
 
66
- template.published_revision.should == revision
66
+ template.published_revision.should eq revision
67
67
  end
68
68
 
69
69
  it 'should unset previous revision.is_published' do
@@ -97,7 +97,7 @@ module Landable
97
97
 
98
98
  template.revert_to! revision
99
99
 
100
- template.published_revision.id.should_not == revision.id
100
+ template.published_revision.id.should_not eq revision.id
101
101
  end
102
102
 
103
103
  it 'should copy revision attributes into the page model' do
@@ -126,8 +126,8 @@ module Landable
126
126
  t.name = 'No Space'
127
127
  t.save!
128
128
 
129
- t.slug.should_not == 'I have no space'
130
- t.slug.should == 'i_have_no_space'
129
+ t.slug.should_not eq 'I have no space'
130
+ t.slug.should eq 'i_have_no_space'
131
131
  end
132
132
 
133
133
  it 'should allow the name to set the slug' do
@@ -135,7 +135,7 @@ module Landable
135
135
  t.name = 'I have no space'
136
136
  t.save!
137
137
 
138
- t.slug.should == 'i_have_no_space'
138
+ t.slug.should eq 'i_have_no_space'
139
139
  end
140
140
  end
141
141
  end
@@ -9,13 +9,13 @@ module Landable
9
9
  it 'returns the most used theme' do
10
10
  t = create :theme
11
11
  t2 = create :theme
12
- t3 = create :theme
12
+ create :theme
13
13
  create :page, theme: t
14
14
  create :page, theme: t
15
15
  create :page, theme: t2
16
16
  create :page, theme: t
17
17
 
18
- Theme.most_used_on_pages.should == t
18
+ Theme.most_used_on_pages.should eq t
19
19
  end
20
20
 
21
21
  it 'return nil when there are no themes' do
@@ -7,14 +7,14 @@ module Landable
7
7
 
8
8
  describe '#url' do
9
9
  it 'should return the entire url as a string' do
10
- referer.url.should == "http://www.something.com/mypath"
10
+ referer.url.should eq 'http://www.something.com/mypath'
11
11
  end
12
12
  end
13
13
 
14
14
  describe '#uri' do
15
15
  it 'should return the URI object' do
16
- test_uri = URI("http://www.something.com/mypath")
17
- referer.uri.should == test_uri
16
+ test_uri = URI('http://www.something.com/mypath')
17
+ referer.uri.should eq test_uri
18
18
  end
19
19
  end
20
20
  end
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Landable::PageRenderResponder do
4
-
5
4
  let(:page) { build :page }
6
5
  let(:responder) { Landable::PageRenderResponder.new double(request: double, formats: []), [page] }
7
6
 
@@ -39,5 +38,4 @@ describe Landable::PageRenderResponder do
39
38
  end
40
39
  end
41
40
  end
42
-
43
41
  end
@@ -1,16 +1,15 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'public page routes' do
4
-
5
4
  routes { Landable::Engine.routes }
6
5
 
7
6
  context 'should match' do
8
7
  let(:author) { create :author }
9
8
  let(:pages) do
10
- [ create(:page, status_code: 200),
11
- create(:page, status_code: 301, redirect_url: 'http://google.com/'),
12
- create(:page, status_code: 302, redirect_url: 'http://foobar.com/'),
13
- create(:page, status_code: 410)
9
+ [create(:page, status_code: 200),
10
+ create(:page, status_code: 301, redirect_url: 'http://google.com/'),
11
+ create(:page, status_code: 302, redirect_url: 'http://foobar.com/'),
12
+ create(:page, status_code: 410)
14
13
  ].each do |page|
15
14
  page.publish! author: author, status_code: page.status_code
16
15
  end
@@ -17,15 +17,15 @@ describe Landable::AuthenticationService do
17
17
  Landable.configuration.stub(authenticators: [simple_auth, echo_auth])
18
18
  end
19
19
 
20
- it "returns the result of the first successful authentication strategy" do
21
- described_class.call('simple', 'authenticator')[:username].should == 'simple'
22
- described_class.call('echo', 'echo')[:username].should == 'echo'
20
+ it 'returns the result of the first successful authentication strategy' do
21
+ described_class.call('simple', 'authenticator')[:username].should eq 'simple'
22
+ described_class.call('echo', 'echo')[:username].should eq 'echo'
23
23
  end
24
24
 
25
- it "raises AuthenticationFailedError if no strategy worked" do
26
- expect {
25
+ it 'raises AuthenticationFailedError if no strategy worked' do
26
+ expect do
27
27
  described_class.call('will', 'fail')
28
- }.to raise_error(Landable::AuthenticationFailedError)
28
+ end.to raise_error(Landable::AuthenticationFailedError)
29
29
  end
30
30
 
31
31
  describe 'EchoAuthenticator' do
@@ -55,7 +55,7 @@ describe Landable::AuthenticationService do
55
55
  instance = echo_auth.new('trogdor', 'some-pass')
56
56
  instance.call('previously', 'worked').should be_nil
57
57
  instance.call('trogdor', 'trogdor').should be_nil
58
- instance.call('trogdor', 'some-pass')[:username].should == 'trogdor'
58
+ instance.call('trogdor', 'some-pass')[:username].should eq 'trogdor'
59
59
  end
60
60
  end
61
61
  end