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
@@ -5,10 +5,10 @@ module Landable
5
5
  let(:page_decorator) { Landable::PageDecorator.new(page) }
6
6
 
7
7
  describe '#title' do
8
- let(:page) { create :page, title: 'title'}
8
+ let(:page) { create :page, title: 'title' }
9
9
 
10
10
  it 'lists the title' do
11
- page_decorator.title.should == "<title>title</title>"
11
+ page_decorator.title.should eq '<title>title</title>'
12
12
  end
13
13
 
14
14
  context 'nil' do
@@ -21,18 +21,18 @@ module Landable
21
21
  end
22
22
 
23
23
  describe '#path' do
24
- let(:page) { create :page, path: "/landable" }
24
+ let(:page) { create :page, path: '/landable' }
25
25
 
26
26
  it 'lists the path' do
27
- page_decorator.path.should == "/landable"
27
+ page_decorator.path.should eq '/landable'
28
28
  end
29
29
  end
30
30
 
31
31
  describe '#body' do
32
- let(:page) { create :page, body: "Buy pounds for your pocket" }
32
+ let(:page) { create :page, body: 'Buy pounds for your pocket' }
33
33
 
34
34
  it 'lists the body' do
35
- page_decorator.body.should == "Buy pounds for your pocket"
35
+ page_decorator.body.should eq 'Buy pounds for your pocket'
36
36
  page_decorator.body.should be_html_safe
37
37
  end
38
38
 
@@ -49,7 +49,7 @@ module Landable
49
49
  let(:page) { create :page, head_content: "<head lang='en' />" }
50
50
 
51
51
  it 'lists the head_tags seperated by a new line' do
52
- page_decorator.head_content.should == "<head lang='en' />"
52
+ page_decorator.head_content.should eq "<head lang='en' />"
53
53
  page_decorator.head_content.should be_html_safe
54
54
  end
55
55
 
@@ -66,7 +66,7 @@ module Landable
66
66
  let(:page) { create :page, meta_tags: { content: 'robots', keyword: 'p2p' } }
67
67
 
68
68
  it 'lists the meta_tags seperated by a new line' do
69
- page_decorator.meta_tags.should == %Q(<meta content="robots" name="content" />\n<meta content="p2p" name="keyword" />)
69
+ page_decorator.meta_tags.should eq %(<meta content="robots" name="content" />\n<meta content="p2p" name="keyword" />)
70
70
  page_decorator.meta_tags.should be_html_safe
71
71
  end
72
72
 
@@ -79,7 +79,7 @@ module Landable
79
79
  end
80
80
 
81
81
  context 'string' do
82
- let(:page) { create :page, meta_tags: "I should be a hash!" }
82
+ let(:page) { create :page, meta_tags: 'I should be a hash!' }
83
83
 
84
84
  it 'returns nil' do
85
85
  page_decorator.meta_tags.should be_nil
@@ -1,5 +1,5 @@
1
1
  module ApplicationHelper
2
2
  def render_hello_world
3
- "hello world"
3
+ 'hello world'
4
4
  end
5
5
  end
@@ -1,14 +1,14 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  # Pick the frameworks you want:
4
- require "active_record/railtie"
5
- require "action_controller/railtie"
6
- require "action_mailer/railtie"
7
- require "sprockets/railtie"
4
+ require 'active_record/railtie'
5
+ require 'action_controller/railtie'
6
+ require 'action_mailer/railtie'
7
+ require 'sprockets/railtie'
8
8
  # require "rails/test_unit/railtie"
9
9
 
10
10
  Bundler.require(*Rails.groups)
11
- require "landable"
11
+ require 'landable'
12
12
 
13
13
  # Always mount Rack::Schema in test / dev environments.
14
14
  ENV['LANDABLE_VALIDATE_JSON'] = '1'
@@ -18,4 +18,3 @@ module Dummy
18
18
  config.active_record.schema_format = :sql
19
19
  end
20
20
  end
21
-
@@ -1,5 +1,5 @@
1
1
  # Set up gems listed in the Gemfile.
2
2
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
3
 
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
5
  $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -14,7 +14,7 @@ Dummy::Application.configure do
14
14
 
15
15
  # Configure static asset server for tests with Cache-Control for performance.
16
16
  config.serve_static_files = true
17
- config.static_cache_control = "public, max-age=3600"
17
+ config.static_cache_control = 'public, max-age=3600'
18
18
 
19
19
  # Show full error reports and disable caching.
20
20
  config.consider_all_requests_local = true
@@ -20,16 +20,17 @@ Landable.configure do |config|
20
20
  messaging_service: BunnyMessagingService,
21
21
  enabled: 'true',
22
22
  event_mapping: {
23
- '/my_path' => { 'GET' => 'Customer Landed',
24
- 'POST' => 'Customer Submitted',
25
- 'DELETE' => 'Customer Left'
26
- }
27
- }.freeze
23
+ '/' => 'Home page',
24
+ '/my_path' => { 'GET' => 'Customer Landed',
25
+ 'POST' => 'Customer Submitted',
26
+ 'DELETE' => 'Customer Left'
27
+ }
28
+ }.freeze
28
29
  }
29
30
  end
30
31
 
31
32
  # Configure asset uploads. Assets will be uploaded to public/uploads by default.
32
33
  # More configuration options: https://github.com/carrierwaveuploader/carrierwave
33
- CarrierWave.configure do |config|
34
+ CarrierWave.configure do |_config|
34
35
  # config.asset_host = 'http://cdn.myapp.com'
35
36
  end
@@ -7,7 +7,7 @@ FactoryGirl.define do
7
7
  sequence(:fixture) do
8
8
  taken = Landable::Asset.pluck(:data)
9
9
  all_fixtures.find { |name| !taken.include?(name) }.tap do |available|
10
- raise "Add more files to spec/fixtures/assets; we've only got #{all_fixtures.length} available." if available.nil?
10
+ fail "Add more files to spec/fixtures/assets; we've only got #{all_fixtures.length} available." if available.nil?
11
11
  end
12
12
  end
13
13
  end
@@ -2,6 +2,6 @@ FactoryGirl.define do
2
2
  factory :audit, class: 'Landable::Audit' do
3
3
  approver 'Marley Pants'
4
4
  notes 'you got served!'
5
- flags ['loans', 'apr']
5
+ flags %w(loans apr)
6
6
  end
7
7
  end
@@ -3,7 +3,7 @@ FactoryGirl.define do
3
3
  sequence(:username) { |n| "trogdor#{n}" }
4
4
  sequence(:email) { |n| "trogdor#{n}@example.com" }
5
5
  first_name 'Marley'
6
- last_name 'Pants'
6
+ last_name 'Pants'
7
7
  end
8
8
 
9
9
  factory :access_token, class: 'Landable::AccessToken' do
@@ -1,6 +1,6 @@
1
1
  FactoryGirl.define do
2
2
  factory :category, class: 'Landable::Category' do
3
3
  sequence(:name) { |n| "Category #{n}" }
4
- description "Factory-generated category"
4
+ description 'Factory-generated category'
5
5
  end
6
6
  end
@@ -8,18 +8,18 @@ FactoryGirl.define do
8
8
  sequence(:path) { |n| "/page-#{n}" }
9
9
  sequence(:title) { |n| "Page #{n}" }
10
10
 
11
- body "<div>Page body</div>"
11
+ body '<div>Page body</div>'
12
12
 
13
13
  head_content "<link rel='alternate' type='application/rss+xml' title='RSS' href='/rss'>"
14
14
 
15
15
  # Anyone see a more reasonable way to unset these attributes?
16
16
  trait :redirect do
17
17
  status_code 301
18
- redirect_url "http://www.redirect.com"
18
+ redirect_url 'http://www.redirect.com'
19
19
 
20
20
  theme nil
21
21
  title nil
22
- body nil
22
+ body nil
23
23
  end
24
24
 
25
25
  trait :gone do
@@ -27,7 +27,7 @@ FactoryGirl.define do
27
27
 
28
28
  theme nil
29
29
  title nil
30
- body nil
30
+ body nil
31
31
  end
32
32
  end
33
33
  end
@@ -1,13 +1,13 @@
1
1
  FactoryGirl.define do
2
2
  factory :template, class: 'Landable::Template' do
3
3
  sequence(:name) { |n| "Template #{n}" }
4
- description "Factory-generated template"
5
- thumbnail_url "http://example.com/bogus-screenshot.png"
4
+ description 'Factory-generated template'
5
+ thumbnail_url 'http://example.com/bogus-screenshot.png'
6
6
  body '<div class="container">content goes here!</div>'
7
7
 
8
8
  trait :partial do
9
9
  editable false
10
- file 'random/partial'
10
+ file 'random/partial'
11
11
  end
12
12
  end
13
13
  end
@@ -1,8 +1,8 @@
1
1
  FactoryGirl.define do
2
2
  factory :theme, class: 'Landable::Theme' do
3
3
  sequence(:name) { |n| "Theme #{n}" }
4
- description "Factory-generated theme"
5
- thumbnail_url "http://example.com/bogus-screenshot.png"
4
+ description 'Factory-generated theme'
5
+ thumbnail_url 'http://example.com/bogus-screenshot.png'
6
6
 
7
7
  body <<-HTML
8
8
  <html>
@@ -8,7 +8,7 @@ module Landable
8
8
  params[:controller] = 'landable/public/preview/pages'
9
9
  params[:id] = page.id
10
10
 
11
- helper.current_page.should == page
11
+ helper.current_page.should eq page
12
12
  end
13
13
 
14
14
  it 'can handle previewing page_revisions' do
@@ -16,7 +16,7 @@ module Landable
16
16
  params[:controller] = 'landable/public/preview/page_revisions'
17
17
  params[:id] = pr.id
18
18
 
19
- helper.current_page.should == pr
19
+ helper.current_page.should eq pr
20
20
  end
21
21
 
22
22
  it 'can handle viewing published pages' do
@@ -24,11 +24,11 @@ module Landable
24
24
  page.publish! author: create(:author)
25
25
  @request.path = page.path
26
26
 
27
- helper.current_page.should == page
27
+ helper.current_page.should eq page
28
28
  end
29
29
 
30
- it "should inherit helpers from the host application" do
31
- helper.render_hello_world.should eql("hello world")
30
+ it 'should inherit helpers from the host application' do
31
+ helper.render_hello_world.should eql('hello world')
32
32
  end
33
33
  end
34
34
  end
@@ -1,20 +1,18 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Landable::Configuration do
4
-
5
4
  describe 'traffic_enabled' do
6
5
  it 'should allow :all, true, false, :html' do
7
6
  [:all, true, false, :html].each do |val|
8
7
  expect { subject.traffic_enabled = val }.to_not raise_error
9
- subject.traffic_enabled.should == val
8
+ subject.traffic_enabled.should eq val
10
9
  end
11
10
  end
12
11
 
13
12
  it 'should not allow bogus values' do
14
- ['foo', 'baz', 'all', 'false'].each do |val|
13
+ %w(foo baz all false).each do |val|
15
14
  expect { subject.traffic_enabled = val }.to raise_error(ArgumentError, 'Landable::Configuration#traffic_enabled accepts false, true, :all or :html')
16
15
  end
17
16
  end
18
17
  end
19
-
20
18
  end
@@ -3,7 +3,6 @@ require 'spec_helper'
3
3
  module Landable
4
4
  module Traffic
5
5
  describe 'EventPublisher', type: :controller do
6
-
7
6
  controller(ApplicationController) do
8
7
  include Landable::Traffic
9
8
  prepend_around_action :track_with_landable!
@@ -15,7 +14,7 @@ module Landable
15
14
 
16
15
  before do
17
16
  routes.draw do
18
- get "/my_path" => 'anonymous#my_path'
17
+ get '/my_path' => 'anonymous#my_path'
19
18
  post '/my_path' => 'anonymous#my_path'
20
19
  delete '/my_path' => 'anonymous#my_path'
21
20
  end
@@ -39,7 +38,6 @@ module Landable
39
38
 
40
39
  it 'should properly properly set the attribution data and send it within a message' do
41
40
  get :my_path, attribution
42
- # binding.pry
43
41
  message_keys.each do |attribute|
44
42
  expect(published_message[attribute]).to eq("test_#{attribute}")
45
43
  end
@@ -4,13 +4,13 @@ require 'spec_helper'
4
4
 
5
5
  module Landable
6
6
  describe Layout do
7
- it "creates themes" do
7
+ it 'creates themes' do
8
8
  Theme.destroy_all
9
9
  expect { described_class.all.each(&:to_theme) }.to change { Theme.count }.by(3)
10
10
  end
11
11
 
12
- it "defaults attributes" do
13
- theme = Theme.where(file: "application").first
12
+ it 'defaults attributes' do
13
+ theme = Theme.where(file: 'application').first
14
14
  theme.attributes.should include({
15
15
  name: 'Application',
16
16
  file: 'application',
@@ -19,7 +19,7 @@ module Landable
19
19
  description: 'Defined in application.html.erb'
20
20
  }.stringify_keys)
21
21
 
22
- theme.body.should == File.read(Rails.root.join('app/views/layouts/application.html.erb'))
22
+ theme.body.should eq File.read(Rails.root.join('app/views/layouts/application.html.erb'))
23
23
  end
24
24
 
25
25
  context 'File Finding' do
@@ -1,24 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Landable::Liquid do
4
-
5
4
  specify 'registered tags' do
6
- Liquid::Template.tags['title_tag'].should == Landable::Liquid::TitleTag
7
- Liquid::Template.tags['meta_tags'].should == Landable::Liquid::MetaTag
8
- Liquid::Template.tags['head_content'].should == Landable::Liquid::HeadContent
9
- Liquid::Template.tags['head'].should == Landable::Liquid::Head
10
- Liquid::Template.tags['body'].should == Landable::Liquid::Body
11
- Liquid::Template.tags['img_tag'].should == Landable::Liquid::AssetTag
12
- Liquid::Template.tags['image_tag'].should == Landable::Liquid::AssetTag
13
- Liquid::Template.tags['javascript_include_tag'].should == Landable::Liquid::AssetTag
14
- Liquid::Template.tags['stylesheet_link_tag'].should == Landable::Liquid::AssetTag
15
- Liquid::Template.tags['asset_url'].should == Landable::Liquid::AssetAttributeTag
16
- Liquid::Template.tags['asset_description'].should == Landable::Liquid::AssetAttributeTag
17
- Liquid::Template.tags['template'].should == Landable::Liquid::TemplateTag
5
+ Liquid::Template.tags['title_tag'].should eq Landable::Liquid::TitleTag
6
+ Liquid::Template.tags['meta_tags'].should eq Landable::Liquid::MetaTag
7
+ Liquid::Template.tags['head_content'].should eq Landable::Liquid::HeadContent
8
+ Liquid::Template.tags['head'].should eq Landable::Liquid::Head
9
+ Liquid::Template.tags['body'].should eq Landable::Liquid::Body
10
+ Liquid::Template.tags['img_tag'].should eq Landable::Liquid::AssetTag
11
+ Liquid::Template.tags['image_tag'].should eq Landable::Liquid::AssetTag
12
+ Liquid::Template.tags['javascript_include_tag'].should eq Landable::Liquid::AssetTag
13
+ Liquid::Template.tags['stylesheet_link_tag'].should eq Landable::Liquid::AssetTag
14
+ Liquid::Template.tags['asset_url'].should eq Landable::Liquid::AssetAttributeTag
15
+ Liquid::Template.tags['asset_description'].should eq Landable::Liquid::AssetAttributeTag
16
+ Liquid::Template.tags['template'].should eq Landable::Liquid::TemplateTag
18
17
  end
19
18
 
20
19
  specify 'registered filters' do
21
20
  Liquid::Strainer.class_variable_get(:@@known_filters).should include(Landable::Liquid::DefaultFilter)
22
21
  end
23
-
24
22
  end
@@ -18,7 +18,7 @@ describe Landable::Migration do
18
18
  describe 'migrate' do
19
19
  let(:connection) { ActiveRecord::Base.connection }
20
20
 
21
- before(:each) do
21
+ before(:each) do
22
22
  ActiveRecord::Base.connection_pool.should_receive(:with_connection).and_yield(connection)
23
23
  end
24
24
 
@@ -32,7 +32,7 @@ describe Landable::Migration do
32
32
 
33
33
  connection.schema_search_path = 'public'
34
34
  FirstMigration.migrate(:up)
35
- connection_search_path.should == 'public'
35
+ connection_search_path.should eq 'public'
36
36
 
37
37
  connection.schema_search_path = default_search_path
38
38
  end
@@ -42,9 +42,9 @@ describe Landable::Migration do
42
42
  it 'should NOT reset the search_path to the original schema_search_path' do
43
43
  connection.schema_search_path = 'public'
44
44
 
45
- connection_search_path.should == 'public'
45
+ connection_search_path.should eq 'public'
46
46
  RegularMigration.migrate(:up)
47
- connection_search_path.should_not == 'public'
47
+ connection_search_path.should_not eq 'public'
48
48
  end
49
49
  end
50
50
  end
@@ -22,43 +22,43 @@ module Landable
22
22
 
23
23
  context 'the templates' do
24
24
  it 'populates a name by humanizing the file' do
25
- @foobazz.name.should == 'Partials Foobazz'
26
- @test.name.should == 'Partials Test'
25
+ @foobazz.name.should eq 'Partials Foobazz'
26
+ @test.name.should eq 'Partials Test'
27
27
  end
28
28
 
29
29
  it 'populates a description' do
30
- @foobazz.description.should == 'The Code for this template can be seen at partials/foobazz in the source code'
31
- @test.description.should == 'The Code for this template can be seen at partials/test in the source code'
30
+ @foobazz.description.should eq 'The Code for this template can be seen at partials/foobazz in the source code'
31
+ @test.description.should eq 'The Code for this template can be seen at partials/test in the source code'
32
32
  end
33
33
 
34
34
  it 'are not editable' do
35
- @foobazz.editable.should == false
36
- @test.editable.should == false
35
+ @foobazz.editable.should eq false
36
+ @test.editable.should eq false
37
37
  end
38
38
 
39
39
  it 'are not layouts' do
40
- @foobazz.is_layout.should == false
41
- @test.is_layout.should == false
40
+ @foobazz.is_layout.should eq false
41
+ @test.is_layout.should eq false
42
42
  end
43
43
 
44
44
  it 'popules a thumbnail_url' do
45
- @foobazz.thumbnail_url.should == 'http://placehold.it/300x200'
46
- @test.thumbnail_url.should == 'http://placehold.it/300x200'
45
+ @foobazz.thumbnail_url.should eq 'http://placehold.it/300x200'
46
+ @test.thumbnail_url.should eq 'http://placehold.it/300x200'
47
47
  end
48
48
 
49
49
  it 'populates a body' do
50
- @foobazz.body.should == ''
51
- @test.body.should == ''
50
+ @foobazz.body.should eq ''
51
+ @test.body.should eq ''
52
52
  end
53
53
 
54
54
  it 'references the flle path' do
55
- @foobazz.file.should == 'partials/foobazz'
56
- @test.file.should == 'partials/test'
55
+ @foobazz.file.should eq 'partials/foobazz'
56
+ @test.file.should eq 'partials/test'
57
57
  end
58
58
 
59
59
  it 'creates a slug by underscoring the name' do
60
- @test.slug.should == 'partials_test'
61
- @foobazz.slug.should == 'partials_foobazz'
60
+ @test.slug.should eq 'partials_test'
61
+ @foobazz.slug.should eq 'partials_foobazz'
62
62
  end
63
63
 
64
64
  it 'creates a published template' do
@@ -73,7 +73,7 @@ module Landable
73
73
  it 'returns an array of files' do
74
74
  Landable.configuration.stub(:partials_to_templates).and_return(partials)
75
75
 
76
- Partial.files.count.should == 2
76
+ Partial.files.count.should eq 2
77
77
  Partial.files.should include('partials/test', 'partials/foobazz')
78
78
  end
79
79
 
@@ -81,7 +81,7 @@ module Landable
81
81
  it 'has no files' do
82
82
  Landable.configuration.stub(:partials_to_templates).and_return([])
83
83
 
84
- Partial.files.should == []
84
+ Partial.files.should eq []
85
85
  end
86
86
  end
87
87
  end