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
@@ -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
|
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:
|
24
|
+
let(:page) { create :page, path: '/landable' }
|
25
25
|
|
26
26
|
it 'lists the path' do
|
27
|
-
page_decorator.path.should
|
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:
|
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
|
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
|
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
|
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:
|
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,14 +1,14 @@
|
|
1
1
|
require File.expand_path('../boot', __FILE__)
|
2
2
|
|
3
3
|
# Pick the frameworks you want:
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
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
|
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
|
-
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -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.
|
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 =
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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 |
|
34
|
+
CarrierWave.configure do |_config|
|
34
35
|
# config.asset_host = 'http://cdn.myapp.com'
|
35
36
|
end
|
data/spec/factories/asset.rb
CHANGED
@@ -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
|
-
|
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
|
data/spec/factories/audit.rb
CHANGED
data/spec/factories/authors.rb
CHANGED
data/spec/factories/category.rb
CHANGED
data/spec/factories/pages.rb
CHANGED
@@ -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
|
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
|
18
|
+
redirect_url 'http://www.redirect.com'
|
19
19
|
|
20
20
|
theme nil
|
21
21
|
title nil
|
22
|
-
body
|
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
|
30
|
+
body nil
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
data/spec/factories/template.rb
CHANGED
@@ -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
|
5
|
-
thumbnail_url
|
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
|
10
|
+
file 'random/partial'
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
data/spec/factories/theme.rb
CHANGED
@@ -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
|
5
|
-
thumbnail_url
|
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
|
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
|
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
|
27
|
+
helper.current_page.should eq page
|
28
28
|
end
|
29
29
|
|
30
|
-
it
|
31
|
-
helper.render_hello_world.should eql(
|
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
|
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
|
-
|
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
|
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
|
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
|
13
|
-
theme = Theme.where(file:
|
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
|
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
|
7
|
-
Liquid::Template.tags['meta_tags'].should
|
8
|
-
Liquid::Template.tags['head_content'].should
|
9
|
-
Liquid::Template.tags['head'].should
|
10
|
-
Liquid::Template.tags['body'].should
|
11
|
-
Liquid::Template.tags['img_tag'].should
|
12
|
-
Liquid::Template.tags['image_tag'].should
|
13
|
-
Liquid::Template.tags['javascript_include_tag'].should
|
14
|
-
Liquid::Template.tags['stylesheet_link_tag'].should
|
15
|
-
Liquid::Template.tags['asset_url'].should
|
16
|
-
Liquid::Template.tags['asset_description'].should
|
17
|
-
Liquid::Template.tags['template'].should
|
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
|
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
|
45
|
+
connection_search_path.should eq 'public'
|
46
46
|
RegularMigration.migrate(:up)
|
47
|
-
connection_search_path.should_not
|
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
|
26
|
-
@test.name.should
|
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
|
31
|
-
@test.description.should
|
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
|
36
|
-
@test.editable.should
|
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
|
41
|
-
@test.is_layout.should
|
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
|
46
|
-
@test.thumbnail_url.should
|
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
|
56
|
-
@test.file.should
|
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
|
61
|
-
@foobazz.slug.should
|
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
|
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
|