metaslug 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/Gemfile +6 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.md +112 -0
  6. data/Rakefile +19 -0
  7. data/lib/metaslug/controllers/action_controller_extension.rb +165 -0
  8. data/lib/metaslug/helpers/action_view_extension.rb +49 -0
  9. data/lib/metaslug/hooks.rb +15 -0
  10. data/lib/metaslug/railtie.rb +7 -0
  11. data/lib/metaslug/version.rb +3 -0
  12. data/lib/metaslug.rb +7 -0
  13. data/lib/rails/generators/metaslug/install/install_generator.rb +21 -0
  14. data/lib/rails/generators/metaslug/locale/locale_generator.rb +69 -0
  15. data/lib/tasks/metaslug_tasks.rake +4 -0
  16. data/metaslug.gemspec +24 -0
  17. data/test/dummy/Rakefile +6 -0
  18. data/test/dummy/app/assets/images/.keep +0 -0
  19. data/test/dummy/app/assets/javascripts/application.js +13 -0
  20. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  21. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  22. data/test/dummy/app/controllers/application_controller.rb +13 -0
  23. data/test/dummy/app/controllers/categories_controller.rb +58 -0
  24. data/test/dummy/app/controllers/concerns/.keep +0 -0
  25. data/test/dummy/app/controllers/pages_controller.rb +12 -0
  26. data/test/dummy/app/controllers/posts_controller.rb +60 -0
  27. data/test/dummy/app/helpers/application_helper.rb +2 -0
  28. data/test/dummy/app/helpers/categories_helper.rb +2 -0
  29. data/test/dummy/app/helpers/metaslug_helper.rb +2 -0
  30. data/test/dummy/app/helpers/pages_helper.rb +2 -0
  31. data/test/dummy/app/helpers/posts_helper.rb +2 -0
  32. data/test/dummy/app/mailers/.keep +0 -0
  33. data/test/dummy/app/models/.keep +0 -0
  34. data/test/dummy/app/models/category.rb +3 -0
  35. data/test/dummy/app/models/concerns/.keep +0 -0
  36. data/test/dummy/app/models/page.rb +3 -0
  37. data/test/dummy/app/models/post.rb +5 -0
  38. data/test/dummy/app/views/categories/_form.html.erb +21 -0
  39. data/test/dummy/app/views/categories/edit.html.erb +6 -0
  40. data/test/dummy/app/views/categories/index.html.erb +25 -0
  41. data/test/dummy/app/views/categories/new.html.erb +5 -0
  42. data/test/dummy/app/views/categories/show.html.erb +9 -0
  43. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  44. data/test/dummy/app/views/pages/show.html.erb +1 -0
  45. data/test/dummy/app/views/posts/_form.html.erb +33 -0
  46. data/test/dummy/app/views/posts/edit.html.erb +6 -0
  47. data/test/dummy/app/views/posts/index.html.erb +31 -0
  48. data/test/dummy/app/views/posts/new.html.erb +5 -0
  49. data/test/dummy/app/views/posts/show.html.erb +24 -0
  50. data/test/dummy/bin/bundle +3 -0
  51. data/test/dummy/bin/rails +4 -0
  52. data/test/dummy/bin/rake +4 -0
  53. data/test/dummy/config/application.rb +23 -0
  54. data/test/dummy/config/boot.rb +5 -0
  55. data/test/dummy/config/database.example.yml +22 -0
  56. data/test/dummy/config/environment.rb +5 -0
  57. data/test/dummy/config/environments/development.rb +37 -0
  58. data/test/dummy/config/environments/production.rb +82 -0
  59. data/test/dummy/config/environments/test.rb +39 -0
  60. data/test/dummy/config/initializers/assets.rb +8 -0
  61. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  62. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  63. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  64. data/test/dummy/config/initializers/inflections.rb +16 -0
  65. data/test/dummy/config/initializers/initializer.rb +1 -0
  66. data/test/dummy/config/initializers/metaslug.rb +1 -0
  67. data/test/dummy/config/initializers/mime_types.rb +4 -0
  68. data/test/dummy/config/initializers/session_store.rb +3 -0
  69. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  70. data/test/dummy/config/locales/de.yml +2 -0
  71. data/test/dummy/config/locales/en.yml +23 -0
  72. data/test/dummy/config/locales/fr.yml +23 -0
  73. data/test/dummy/config/metaslug/de.yml +4 -0
  74. data/test/dummy/config/metaslug/en.yml +61 -0
  75. data/test/dummy/config/metaslug/fr.yml +41 -0
  76. data/test/dummy/config/routes.rb +12 -0
  77. data/test/dummy/config.ru +4 -0
  78. data/test/dummy/db/migrate/20140924091048_create_posts.rb +12 -0
  79. data/test/dummy/db/migrate/20140924091105_create_categories.rb +9 -0
  80. data/test/dummy/db/migrate/20140925101545_create_pages.rb +11 -0
  81. data/test/dummy/db/migrate/20140929145421_add_title_and_description_to_page.rb +6 -0
  82. data/test/dummy/db/schema.rb +43 -0
  83. data/test/dummy/lib/assets/.keep +0 -0
  84. data/test/dummy/log/.keep +0 -0
  85. data/test/dummy/public/404.html +67 -0
  86. data/test/dummy/public/422.html +67 -0
  87. data/test/dummy/public/500.html +66 -0
  88. data/test/dummy/public/favicon.ico +0 -0
  89. data/test/dummy/test/fixtures/categories.yml +7 -0
  90. data/test/dummy/test/fixtures/pages.yml +23 -0
  91. data/test/dummy/test/fixtures/posts.yml +13 -0
  92. data/test/dummy/test/helpers/metaslug_helper_test.rb +25 -0
  93. data/test/dummy/test/integration/metas_test.rb +91 -0
  94. data/test/metaslug_test.rb +5 -0
  95. data/test/test_helper.rb +30 -0
  96. metadata +274 -0
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1 @@
1
+ # Add initialization content here
@@ -0,0 +1 @@
1
+ require 'liquid'
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,2 @@
1
+ de:
2
+ hello: "Hello world"
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ fr:
23
+ hello: "Hello world"
@@ -0,0 +1,4 @@
1
+ de:
2
+ default:
3
+ description: "Standardbeschreibung"
4
+ title: "Standardtitel"
@@ -0,0 +1,61 @@
1
+ en:
2
+ default:
3
+ description: "Default description"
4
+ title: "Default title"
5
+ "/posts":
6
+ description: ""
7
+ title: ""
8
+ "/posts/new":
9
+ description: ""
10
+ title: ""
11
+ "/posts/:id/edit":
12
+ description: ""
13
+ title: "Edit {{post.title}}"
14
+ "/posts/:id":
15
+ description: ""
16
+ title: "{{post.title}}"
17
+ og:
18
+ title: "{{post.title}}"
19
+ "/categories/:category_id/posts":
20
+ description: ""
21
+ title: ""
22
+ "/categories/:category_id/posts/new":
23
+ description: ""
24
+ title: ""
25
+ "/categories/:category_id/posts/:id/edit":
26
+ description: ""
27
+ title: ""
28
+ "/categories/:category_id/posts/:id":
29
+ description: ""
30
+ title: ""
31
+ "/categories":
32
+ description: "List of categories"
33
+ title: "Categories"
34
+ keywords: "categories, test"
35
+ "/categories/new":
36
+ description: ""
37
+ title: ""
38
+ "/categories/:id/edit":
39
+ description: ""
40
+ title: "Edit this category"
41
+ og:
42
+ title: "Edit {{post.title}}"
43
+ "/categories/:id":
44
+ description: ""
45
+ title: "Category {{category.title}}"
46
+ "/twitter":
47
+ title: "Twitter"
48
+ twitter:
49
+ title: "Twitter title"
50
+ url: "Twitter url"
51
+ "/awesome-page":
52
+ description: ""
53
+ title: "Really awesome"
54
+ og:
55
+ title: "Awesome page"
56
+ locale:
57
+ alternate: "fr_FR"
58
+ # catch all slug
59
+ "/:slug":
60
+ title: "{{page.title}}"
61
+ description: "{{page.description}}"
@@ -0,0 +1,41 @@
1
+ fr:
2
+ "/posts":
3
+ description: ""
4
+ title: ""
5
+ "/posts/new":
6
+ description: ""
7
+ title: ""
8
+ "/posts/:id/edit":
9
+ description: ""
10
+ title: ""
11
+ "/posts/:id":
12
+ description: ""
13
+ title: "{{post.title}}"
14
+ "/categories/:category_id/posts":
15
+ description: ""
16
+ title: ""
17
+ "/categories/:category_id/posts/new":
18
+ description: ""
19
+ title: ""
20
+ "/categories/:category_id/posts/:id/edit":
21
+ description: ""
22
+ title: ""
23
+ "/categories/:category_id/posts/:id":
24
+ description: ""
25
+ title: ""
26
+ "/categories":
27
+ description: "Liste des catégories"
28
+ title: "Catégories"
29
+ keywords: "catégories, test"
30
+ "/categories/new":
31
+ description: ""
32
+ title: ""
33
+ "/categories/:id/edit":
34
+ description: ""
35
+ title: "Modifier cette catégorie"
36
+ "/categories/:id":
37
+ description: ""
38
+ title: ""
39
+ "/awesome-page":
40
+ description: ""
41
+ title: "Super page"
@@ -0,0 +1,12 @@
1
+ Rails.application.routes.draw do
2
+ resources :posts
3
+
4
+ resources :categories do
5
+ resources :posts
6
+ end
7
+
8
+ root 'categories#index'
9
+
10
+ # show page related to slug
11
+ get '/:slug' => 'pages#show'
12
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,12 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :posts do |t|
4
+ t.text :content
5
+ t.string :title
6
+ t.boolean :active
7
+ t.references :category, index: true
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ class CreateCategories < ActiveRecord::Migration
2
+ def change
3
+ create_table :categories do |t|
4
+ t.string :title
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ class CreatePages < ActiveRecord::Migration
2
+ def change
3
+ create_table :pages do |t|
4
+ t.string :name
5
+ t.text :content
6
+ t.string :slug
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class AddTitleAndDescriptionToPage < ActiveRecord::Migration
2
+ def change
3
+ add_column :pages, :title, :string
4
+ add_column :pages, :description, :text
5
+ end
6
+ end
@@ -0,0 +1,43 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20140929145421) do
15
+
16
+ create_table "categories", force: true do |t|
17
+ t.string "title"
18
+ t.datetime "created_at"
19
+ t.datetime "updated_at"
20
+ end
21
+
22
+ create_table "pages", force: true do |t|
23
+ t.string "name"
24
+ t.text "content"
25
+ t.string "slug"
26
+ t.datetime "created_at"
27
+ t.datetime "updated_at"
28
+ t.string "title"
29
+ t.text "description"
30
+ end
31
+
32
+ create_table "posts", force: true do |t|
33
+ t.text "content"
34
+ t.string "title"
35
+ t.boolean "active"
36
+ t.integer "category_id"
37
+ t.datetime "created_at"
38
+ t.datetime "updated_at"
39
+ end
40
+
41
+ add_index "posts", ["category_id"], name: "index_posts_on_category_id"
42
+
43
+ end
File without changes
File without changes
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body>
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ phone:
4
+ title: Phone
5
+
6
+ computer:
7
+ title: Computer
@@ -0,0 +1,23 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ home:
4
+ name: First page
5
+ content: This page looks very nice.
6
+ slug: awesome-page
7
+
8
+ without_metas:
9
+ name: "Without metas"
10
+ content: This page should have default metas
11
+ slug: without-metas
12
+
13
+ another_page:
14
+ name: "Yet another page"
15
+ content: "Boring stuff"
16
+ title: "Yet another page"
17
+ description: "Don't tell them it's boring"
18
+ slug: "another-page"
19
+
20
+ twitter:
21
+ name: "Twitter page"
22
+ content: Twitter informations
23
+ slug: twitter
@@ -0,0 +1,13 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ phone:
4
+ content: "bla bla"
5
+ title: Phone article
6
+ active: false
7
+ category: phone
8
+
9
+ computer:
10
+ content: "bla bla"
11
+ title: Computer article
12
+ active: false
13
+ category: computer
@@ -0,0 +1,25 @@
1
+ require 'test_helper'
2
+
3
+ class MetaslugHelperTest < ActionView::TestCase
4
+ include Metaslug::ActionViewExtension
5
+
6
+ test "should return title" do
7
+ @metaslug = { 'title' => 'Foo' }
8
+ assert_equal "<title>Foo</title>", metaslug
9
+ end
10
+
11
+ test "should return description" do
12
+ @metaslug = { 'description' => 'Foo' }
13
+ assert_equal "<meta content=\"Foo\" name=\"description\"></meta>", metaslug
14
+ end
15
+
16
+ test "should return opengraph title" do
17
+ @metaslug = { 'og' => { 'title' => 'Foo' } }
18
+ assert_equal "<meta content=\"Foo\" property=\"og:title\"></meta>", metaslug
19
+ end
20
+
21
+ test "should return deep metas" do
22
+ @metaslug = { 'og' => { 'locale' => { 'alternate' => 'fr_FR' } } }
23
+ assert_equal "<meta content=\"fr_FR\" property=\"og:locale:alternate\"></meta>", metaslug
24
+ end
25
+ end