ecm_tags 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/ecm/tags/tagging.rb +16 -0
  3. data/config/initializers/inject_taggable_concern.rb +6 -0
  4. data/config/locales/de.yml +18 -8
  5. data/config/locales/en.yml +21 -8
  6. data/lib/ecm/tags/configuration.rb +3 -3
  7. data/lib/ecm/tags/engine.rb +0 -7
  8. data/lib/ecm/tags/version.rb +1 -1
  9. data/lib/generators/ecm/tags/install/templates/initializer.rb +10 -5
  10. data/spec/dummy/README.rdoc +28 -0
  11. data/spec/dummy/Rakefile +6 -0
  12. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  13. data/spec/dummy/app/assets/javascripts/posts.js +2 -0
  14. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  15. data/spec/dummy/app/assets/stylesheets/posts.css +4 -0
  16. data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
  17. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  18. data/spec/dummy/app/controllers/frontend_controller.rb +2 -0
  19. data/spec/dummy/app/controllers/posts_controller.rb +59 -0
  20. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  21. data/spec/dummy/app/helpers/posts_helper.rb +2 -0
  22. data/spec/dummy/app/models/post.rb +4 -0
  23. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  24. data/spec/dummy/app/views/posts/_form.html.erb +25 -0
  25. data/spec/dummy/app/views/posts/_post.html.erb +3 -0
  26. data/spec/dummy/app/views/posts/edit.html.erb +6 -0
  27. data/spec/dummy/app/views/posts/index.html.erb +29 -0
  28. data/spec/dummy/app/views/posts/new.html.erb +5 -0
  29. data/spec/dummy/app/views/posts/show.html.erb +14 -0
  30. data/spec/dummy/bin/bundle +3 -0
  31. data/spec/dummy/bin/rails +4 -0
  32. data/spec/dummy/bin/rake +4 -0
  33. data/spec/dummy/bin/setup +29 -0
  34. data/spec/dummy/config.ru +4 -0
  35. data/spec/dummy/config/application.rb +31 -0
  36. data/spec/dummy/config/boot.rb +5 -0
  37. data/spec/dummy/config/database.yml +25 -0
  38. data/spec/dummy/config/environment.rb +5 -0
  39. data/spec/dummy/config/environments/development.rb +41 -0
  40. data/spec/dummy/config/environments/production.rb +79 -0
  41. data/spec/dummy/config/environments/test.rb +42 -0
  42. data/spec/dummy/config/initializers/assets.rb +11 -0
  43. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  44. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  45. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  46. data/spec/dummy/config/initializers/inflections.rb +16 -0
  47. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  48. data/spec/dummy/config/initializers/session_store.rb +3 -0
  49. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  50. data/spec/dummy/config/locales/en.yml +23 -0
  51. data/spec/dummy/config/routes.rb +5 -0
  52. data/spec/dummy/config/secrets.yml +22 -0
  53. data/spec/dummy/db/development.sqlite3 +0 -0
  54. data/spec/dummy/db/migrate/20160212133931_create_ecm_tags_tags.ecm_tags.rb +11 -0
  55. data/spec/dummy/db/migrate/20160212133932_create_ecm_tags_taggings.ecm_tags.rb +18 -0
  56. data/spec/dummy/db/migrate/20160212134222_create_posts.rb +10 -0
  57. data/spec/dummy/db/schema.rb +41 -0
  58. data/spec/dummy/db/test.sqlite3 +0 -0
  59. data/spec/dummy/public/404.html +67 -0
  60. data/spec/dummy/public/422.html +67 -0
  61. data/spec/dummy/public/500.html +66 -0
  62. data/spec/dummy/public/favicon.ico +0 -0
  63. data/spec/dummy/spec/controllers/posts_controller_spec.rb +157 -0
  64. data/spec/dummy/spec/factories/posts.rb +6 -0
  65. data/spec/dummy/spec/helpers/posts_helper_spec.rb +15 -0
  66. data/spec/dummy/spec/models/post_spec.rb +5 -0
  67. data/spec/dummy/spec/requests/posts_spec.rb +10 -0
  68. data/spec/dummy/spec/routing/posts_routing_spec.rb +37 -0
  69. data/spec/dummy/spec/views/posts/edit.html.erb_spec.rb +20 -0
  70. data/spec/dummy/spec/views/posts/index.html.erb_spec.rb +22 -0
  71. data/spec/dummy/spec/views/posts/new.html.erb_spec.rb +20 -0
  72. data/spec/dummy/spec/views/posts/show.html.erb_spec.rb +16 -0
  73. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-Rk46EWcF9JNQvs4jamoC5UetyQe_Liydnzz339Ah5c.cache +2 -0
  74. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/-tiBAjaN_MhRxnGs10DJTQjnj4h1yRQkeejcmBYdwJo.cache +1 -0
  75. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/2Yi2yjcAHgeIXKOYmsGlDp7Jc9-YxdBAerr4uk4uO0Q.cache +0 -0
  76. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/3vFcUkP2kWu2iktHlcSC_OfjYi3u_BqXmoCf2gvEE2M.cache +0 -0
  77. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/4JaU4ZW9j_RMb-z_fzYbPLoZctdUv0Fzt3_U-gy3kAw.cache +1 -0
  78. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  79. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5P-OzgUkwyAgoOv7CZL2UfSgs4rcG7DcMYr5WUkHaZc.cache +1 -0
  80. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/5TzYmONEI2HYkxGdPZU9iJFCuuoe70CB-i-w-KEHZv0.cache +2 -0
  81. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/6H66m5FQazePA0g_qkHvuCMPzaPtznXdj-yAWWUtPnw.cache +1 -0
  82. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/7C_O90lo1Yi2b0Ed9bpFF6gUVqTrK_4goAv2_cdLnSI.cache +1 -0
  83. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/8wkEYFnE3ZJ8vdlwNXJpFg1xc81ULuNYx7O-FuYA55w.cache +1 -0
  84. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/AAiF0geR48ctD2aHAqAVSLKQFWesFqJLP-ZGPId5wWM.cache +1 -0
  85. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ClUHQDSdna_TRtjSG_r6jD3hQEmJ_laO_2IDDTNafGw.cache +1 -0
  86. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/DesJkeilWecg6a2hoWgP6KtHYFXVculbTQwOY824Ov0.cache +0 -0
  87. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/DmmfrCpXtt74Hr6NO54lxyOCDv6klnDyBqeDFR7oDU8.cache +2 -0
  88. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ETOLFW7z9GHBdRPSYUVj-RVoXPXxMmOc86KlwkUFXWM.cache +1 -0
  89. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/FQvx5zKlMSn1gKaT7Elj4CgsWHC-_8FYDN_VO0vyGH4.cache +0 -0
  90. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/I-Fn3is-YC5z6FFns4kf2DQWiNPmSh5FE6mqR4hNeqY.cache +1 -0
  91. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JAmHv7GyzaWXmLMT2CiP8pUuvPOX7gNlyP7DcId3xcA.cache +1 -0
  92. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/JIV6P9o3lv6AF-6_7Yd35SryD44vS_LPdThsYeXjgQk.cache +1 -0
  93. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/KB1t0DQJfRViGhML3u0NuVlVpQHjbFYWs_SrFvbXQB0.cache +1 -0
  94. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/M76cE2oAZjvfK9meOD0uCS1k5slLFYxmtLiMykNl1oY.cache +0 -0
  95. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/MWYCQbJoVG_HtuEyKiBNUM4zGAV9pVXr6uoxvtpixrE.cache +1 -0
  96. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
  97. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Q8H_klVplUAUyXyRxcoz5K3HyirGXjwxQ9-6sTKm74U.cache +0 -0
  98. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/RSK82eed7XubPBRL-4jf0eOlKgtGg-ooQXrY0F4W194.cache +0 -0
  99. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/Z_pLuEtd8bZcpv5q0r6aYNl9SP4KClCsP-i0wAOelmM.cache +1 -0
  100. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/dlQOci5ZlcWlh7tHZpxpamNwe343IjDbezrfcPEcPw0.cache +3 -0
  101. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/egxIcSNP_AHgCIboNW03qbGhxwrCOcPqms6nGntC7Fs.cache +0 -0
  102. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
  103. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/i18WqDjAKooAMM0YPXJRMtHBycPcmo-BU8eoqXKyfPU.cache +0 -0
  104. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/jVD7-rQv89s_Pta-2_Sf9U7i8ao1gix2Lp90ISIkasA.cache +2 -0
  105. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/nWo2ysO8pNRVLI4LiUqzjyZyrU1cIxq20bSCDbgswdM.cache +2 -0
  106. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/ompUzgaB0qfmoE6djKuHjLjMYlToLX0_lb6iFwWPO0o.cache +2 -0
  107. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  108. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pOoJAHtZ3sqU9_DaqDFTu0HPRhuSfgJDE8bdi9IVlI4.cache +1 -0
  109. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/pzyYjBHQiM-yOIhztKOpuHU7Jepq82zWJg-mzp5L418.cache +1 -0
  110. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wJMzpOMn4cGBbHRf1uOBEApoBZag48B9djjpFhAG8mE.cache +1 -0
  111. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/wafl6XJiIk4VCd-yj42MMaao0dyAqQSTSPn0YiXvElQ.cache +0 -0
  112. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/xuNJ32gKsrwphnFigSODyGeYqNKhBBSa49ffAXRJ8jg.cache +3 -0
  113. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zF3sNycdAc5fpqhKKmuKS2F2Zc-OkZ-T2Qiqq4ywang.cache +0 -0
  114. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zMHd1CpL0ukpIS90SExzXc3eTzMQreOm__lG4fVygp8.cache +1 -0
  115. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zPep_9K14vA0ICucNx5t8umt9e2caMo0jvNg80b4kJs.cache +1 -0
  116. data/spec/dummy/tmp/cache/assets/sprockets/v3.0/zt-2He-6ayIMtuqNcliVhJNUcEnCi6M39pTVaXV9VjA.cache +0 -0
  117. data/spec/factories/ecm_tags_taggings.rb +6 -0
  118. data/spec/factories/ecm_tags_tags.rb +6 -0
  119. data/spec/features/ecm/tags/search_spec.rb +19 -0
  120. data/spec/models/ecm/tags/tag_search_spec.rb +43 -0
  121. data/spec/rails_helper.rb +57 -0
  122. data/spec/spec_helper.rb +90 -0
  123. data/spec/support/capybara.rb +1 -0
  124. data/spec/support/factory_girl_rails.rb +5 -0
  125. data/spec/support/formulaic.rb +5 -0
  126. data/spec/support/shoulda_matchers.rb +8 -0
  127. metadata +120 -2
@@ -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,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,5 @@
1
+ Rails.application.routes.draw do
2
+ resources :posts
3
+
4
+ mount Ecm::Tags::Engine, at: '/tags'
5
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 608e4a4118519a4b87856943ecff4091ab56c22855001d735e3b1d7a51acfd02115109da7098e2677f86e356c7ee3834d1201d20942a7dab56111b371c0e7168
15
+
16
+ test:
17
+ secret_key_base: 6ab228ed97f9c8e5fd24d18978badefd4b7e591c30ce04324e01fafcd8a5f80a668e7f30c7432c177dc42ba88ec8b112e087358faa540140da6a465ecb4d1460
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
Binary file
@@ -0,0 +1,11 @@
1
+ # This migration comes from ecm_tags (originally 20160208121254)
2
+ class CreateEcmTagsTags < ActiveRecord::Migration[4.2]
3
+ def change
4
+ create_table :ecm_tags_tags do |t|
5
+ t.string 'name'
6
+ t.integer 'taggings_count', default: 0
7
+ end
8
+
9
+ add_index 'ecm_tags_tags', ['name'], name: 'index_tags_on_name', unique: true
10
+ end
11
+ end
@@ -0,0 +1,18 @@
1
+ # This migration comes from ecm_tags (originally 20160208121300)
2
+ # This migration comes from ecm_tags (originally 20160208121300)
3
+ class CreateEcmTagsTaggings < ActiveRecord::Migration[4.2]
4
+ def change
5
+ create_table :ecm_tags_taggings do |t|
6
+ t.integer 'tag_id'
7
+ t.integer 'taggable_id'
8
+ t.string 'taggable_type'
9
+ t.integer 'tagger_id'
10
+ t.string 'tagger_type'
11
+ t.string 'context', limit: 128
12
+ t.datetime 'created_at'
13
+ end
14
+
15
+ add_index 'ecm_tags_taggings', %w(tag_id taggable_id taggable_type context tagger_id tagger_type), name: 'taggings_idx', unique: true
16
+ add_index 'ecm_tags_taggings', %w(taggable_id taggable_type context), name: 'index_taggings_on_taggable_id_and_taggable_type_and_context'
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ class CreatePosts < ActiveRecord::Migration[4.2]
2
+ def change
3
+ create_table :posts do |t|
4
+ t.string :title
5
+ t.text :body
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,41 @@
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: 20_160_212_134_222) do
15
+ create_table 'ecm_tags_taggings', force: :cascade do |t|
16
+ t.integer 'tag_id'
17
+ t.integer 'taggable_id'
18
+ t.string 'taggable_type'
19
+ t.integer 'tagger_id'
20
+ t.string 'tagger_type'
21
+ t.string 'context', limit: 128
22
+ t.datetime 'created_at'
23
+ end
24
+
25
+ add_index 'ecm_tags_taggings', %w(tag_id taggable_id taggable_type context tagger_id tagger_type), name: 'taggings_idx', unique: true
26
+ add_index 'ecm_tags_taggings', %w(taggable_id taggable_type context), name: 'index_taggings_on_taggable_id_and_taggable_type_and_context'
27
+
28
+ create_table 'ecm_tags_tags', force: :cascade do |t|
29
+ t.string 'name'
30
+ t.integer 'taggings_count', default: 0
31
+ end
32
+
33
+ add_index 'ecm_tags_tags', ['name'], name: 'index_tags_on_name', unique: true
34
+
35
+ create_table 'posts', force: :cascade do |t|
36
+ t.string 'title'
37
+ t.text 'body'
38
+ t.datetime 'created_at', null: false
39
+ t.datetime 'updated_at', null: false
40
+ end
41
+ end
Binary file
@@ -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,157 @@
1
+ require 'rails_helper'
2
+
3
+ # This spec was generated by rspec-rails when you ran the scaffold generator.
4
+ # It demonstrates how one might use RSpec to specify the controller code that
5
+ # was generated by Rails when you ran the scaffold generator.
6
+ #
7
+ # It assumes that the implementation code is generated by the rails scaffold
8
+ # generator. If you are using any extension libraries to generate different
9
+ # controller code, this generated spec may or may not pass.
10
+ #
11
+ # It only uses APIs available in rails and/or rspec-rails. There are a number
12
+ # of tools you can use to make these specs even more expressive, but we're
13
+ # sticking to rails and rspec-rails APIs to keep things simple and stable.
14
+ #
15
+ # Compared to earlier versions of this generator, there is very limited use of
16
+ # stubs and message expectations in this spec. Stubs are only used when there
17
+ # is no simpler way to get a handle on the object needed for the example.
18
+ # Message expectations are only used when there is no simpler way to specify
19
+ # that an instance is receiving a specific message.
20
+
21
+ RSpec.describe PostsController, type: :controller do
22
+ # This should return the minimal set of attributes required to create a valid
23
+ # Post. As you add validations to Post, be sure to
24
+ # adjust the attributes here as well.
25
+ let(:valid_attributes) do
26
+ skip('Add a hash of attributes valid for your model')
27
+ end
28
+
29
+ let(:invalid_attributes) do
30
+ skip('Add a hash of attributes invalid for your model')
31
+ end
32
+
33
+ # This should return the minimal set of values that should be in the session
34
+ # in order to pass any filters (e.g. authentication) defined in
35
+ # PostsController. Be sure to keep this updated too.
36
+ let(:valid_session) { {} }
37
+
38
+ describe 'GET #index' do
39
+ it 'assigns all posts as @posts' do
40
+ post = Post.create! valid_attributes
41
+ get :index, {}, valid_session
42
+ expect(assigns(:posts)).to eq([post])
43
+ end
44
+ end
45
+
46
+ describe 'GET #show' do
47
+ it 'assigns the requested post as @post' do
48
+ post = Post.create! valid_attributes
49
+ get :show, { id: post.to_param }, valid_session
50
+ expect(assigns(:post)).to eq(post)
51
+ end
52
+ end
53
+
54
+ describe 'GET #new' do
55
+ it 'assigns a new post as @post' do
56
+ get :new, {}, valid_session
57
+ expect(assigns(:post)).to be_a_new(Post)
58
+ end
59
+ end
60
+
61
+ describe 'GET #edit' do
62
+ it 'assigns the requested post as @post' do
63
+ post = Post.create! valid_attributes
64
+ get :edit, { id: post.to_param }, valid_session
65
+ expect(assigns(:post)).to eq(post)
66
+ end
67
+ end
68
+
69
+ describe 'POST #create' do
70
+ context 'with valid params' do
71
+ it 'creates a new Post' do
72
+ expect do
73
+ post :create, { post: valid_attributes }, valid_session
74
+ end.to change(Post, :count).by(1)
75
+ end
76
+
77
+ it 'assigns a newly created post as @post' do
78
+ post :create, { post: valid_attributes }, valid_session
79
+ expect(assigns(:post)).to be_a(Post)
80
+ expect(assigns(:post)).to be_persisted
81
+ end
82
+
83
+ it 'redirects to the created post' do
84
+ post :create, { post: valid_attributes }, valid_session
85
+ expect(response).to redirect_to(Post.last)
86
+ end
87
+ end
88
+
89
+ context 'with invalid params' do
90
+ it 'assigns a newly created but unsaved post as @post' do
91
+ post :create, { post: invalid_attributes }, valid_session
92
+ expect(assigns(:post)).to be_a_new(Post)
93
+ end
94
+
95
+ it "re-renders the 'new' template" do
96
+ post :create, { post: invalid_attributes }, valid_session
97
+ expect(response).to render_template('new')
98
+ end
99
+ end
100
+ end
101
+
102
+ describe 'PUT #update' do
103
+ context 'with valid params' do
104
+ let(:new_attributes) do
105
+ skip('Add a hash of attributes valid for your model')
106
+ end
107
+
108
+ it 'updates the requested post' do
109
+ post = Post.create! valid_attributes
110
+ put :update, { id: post.to_param, post: new_attributes }, valid_session
111
+ post.reload
112
+ skip('Add assertions for updated state')
113
+ end
114
+
115
+ it 'assigns the requested post as @post' do
116
+ post = Post.create! valid_attributes
117
+ put :update, { id: post.to_param, post: valid_attributes }, valid_session
118
+ expect(assigns(:post)).to eq(post)
119
+ end
120
+
121
+ it 'redirects to the post' do
122
+ post = Post.create! valid_attributes
123
+ put :update, { id: post.to_param, post: valid_attributes }, valid_session
124
+ expect(response).to redirect_to(post)
125
+ end
126
+ end
127
+
128
+ context 'with invalid params' do
129
+ it 'assigns the post as @post' do
130
+ post = Post.create! valid_attributes
131
+ put :update, { id: post.to_param, post: invalid_attributes }, valid_session
132
+ expect(assigns(:post)).to eq(post)
133
+ end
134
+
135
+ it "re-renders the 'edit' template" do
136
+ post = Post.create! valid_attributes
137
+ put :update, { id: post.to_param, post: invalid_attributes }, valid_session
138
+ expect(response).to render_template('edit')
139
+ end
140
+ end
141
+ end
142
+
143
+ describe 'DELETE #destroy' do
144
+ it 'destroys the requested post' do
145
+ post = Post.create! valid_attributes
146
+ expect do
147
+ delete :destroy, { id: post.to_param }, valid_session
148
+ end.to change(Post, :count).by(-1)
149
+ end
150
+
151
+ it 'redirects to the posts list' do
152
+ post = Post.create! valid_attributes
153
+ delete :destroy, { id: post.to_param }, valid_session
154
+ expect(response).to redirect_to(posts_url)
155
+ end
156
+ end
157
+ end