polymorphic_render 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +61 -0
  4. data/Rakefile +34 -0
  5. data/app/helpers/polymorphic_render/application_helper.rb +15 -0
  6. data/lib/polymorphic_render/engine.rb +4 -0
  7. data/lib/polymorphic_render/version.rb +3 -0
  8. data/lib/polymorphic_render.rb +4 -0
  9. data/test/dummy/README.rdoc +28 -0
  10. data/test/dummy/Rakefile +6 -0
  11. data/test/dummy/app/assets/javascripts/application.js +13 -0
  12. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  13. data/test/dummy/app/controllers/application_controller.rb +5 -0
  14. data/test/dummy/app/helpers/application_helper.rb +2 -0
  15. data/test/dummy/app/models/post.rb +2 -0
  16. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  17. data/test/dummy/app/views/posts/_post.html.erb +1 -0
  18. data/test/dummy/app/views/posts/_post_admin.html.erb +1 -0
  19. data/test/dummy/bin/bundle +3 -0
  20. data/test/dummy/bin/rails +4 -0
  21. data/test/dummy/bin/rake +4 -0
  22. data/test/dummy/config/application.rb +23 -0
  23. data/test/dummy/config/boot.rb +5 -0
  24. data/test/dummy/config/database.yml +25 -0
  25. data/test/dummy/config/environment.rb +5 -0
  26. data/test/dummy/config/environments/development.rb +29 -0
  27. data/test/dummy/config/environments/production.rb +80 -0
  28. data/test/dummy/config/environments/test.rb +36 -0
  29. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  30. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  31. data/test/dummy/config/initializers/inflections.rb +16 -0
  32. data/test/dummy/config/initializers/mime_types.rb +5 -0
  33. data/test/dummy/config/initializers/secret_token.rb +12 -0
  34. data/test/dummy/config/initializers/session_store.rb +3 -0
  35. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  36. data/test/dummy/config/locales/en.yml +23 -0
  37. data/test/dummy/config/routes.rb +56 -0
  38. data/test/dummy/config.ru +4 -0
  39. data/test/dummy/db/development.sqlite3 +0 -0
  40. data/test/dummy/db/migrate/20140303085238_create_posts.rb +9 -0
  41. data/test/dummy/db/schema.rb +22 -0
  42. data/test/dummy/db/test.sqlite3 +0 -0
  43. data/test/dummy/log/development.log +14 -0
  44. data/test/dummy/log/test.log +203 -0
  45. data/test/dummy/public/404.html +58 -0
  46. data/test/dummy/public/422.html +58 -0
  47. data/test/dummy/public/500.html +57 -0
  48. data/test/dummy/public/favicon.ico +0 -0
  49. data/test/dummy/test/fixtures/posts.yml +7 -0
  50. data/test/dummy/test/models/post_test.rb +7 -0
  51. data/test/helpers/application_helper_test.rb +26 -0
  52. data/test/integration/navigation_test.rb +10 -0
  53. data/test/polymorphic_render_test.rb +7 -0
  54. data/test/test_helper.rb +15 -0
  55. metadata +170 -0
@@ -0,0 +1,9 @@
1
+ class CreatePosts < ActiveRecord::Migration
2
+ def change
3
+ create_table :posts do |t|
4
+ t.string :title
5
+
6
+ t.timestamps
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,22 @@
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: 20140303085238) do
15
+
16
+ create_table "posts", force: true do |t|
17
+ t.string "title"
18
+ t.datetime "created_at"
19
+ t.datetime "updated_at"
20
+ end
21
+
22
+ end
Binary file
@@ -0,0 +1,14 @@
1
+  (1.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
2
+  (1.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
4
+ Migrating to CreatePosts (20140303085238)
5
+  (0.1ms) begin transaction
6
+  (1.1ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "created_at" datetime, "updated_at" datetime) 
7
+ SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20140303085238"]]
8
+  (1.1ms) commit transaction
9
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
10
+  (1.2ms) CREATE TABLE "posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "created_at" datetime, "updated_at" datetime) 
11
+  (1.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
12
+  (1.1ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
13
+  (0.2ms) SELECT version FROM "schema_migrations"
14
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20140303085238')
@@ -0,0 +1,203 @@
1
+  (0.3ms) begin transaction
2
+ ---------------------------------
3
+ PolymorphicRenderTest: test_truth
4
+ ---------------------------------
5
+  (0.1ms) rollback transaction
6
+  (0.3ms) begin transaction
7
+ ---------------------------------
8
+ PolymorphicRenderTest: test_truth
9
+ ---------------------------------
10
+  (0.1ms) rollback transaction
11
+  (0.3ms) begin transaction
12
+ ---------------------------------------------------------------
13
+ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
14
+ ---------------------------------------------------------------
15
+  (0.1ms) rollback transaction
16
+  (0.1ms) begin transaction
17
+ ---------------------------------
18
+ PolymorphicRenderTest: test_truth
19
+ ---------------------------------
20
+  (0.1ms) rollback transaction
21
+  (0.3ms) begin transaction
22
+ ---------------------------------------------------------------
23
+ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
24
+ ---------------------------------------------------------------
25
+  (0.1ms) rollback transaction
26
+  (0.1ms) begin transaction
27
+ ---------------------------------
28
+ PolymorphicRenderTest: test_truth
29
+ ---------------------------------
30
+  (0.1ms) rollback transaction
31
+  (0.6ms) begin transaction
32
+ ---------------------------------------------------------------
33
+ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
34
+ ---------------------------------------------------------------
35
+  (0.9ms) SAVEPOINT active_record_1
36
+ SQL (7.6ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:02:49 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:02:49 UTC +00:00]]
37
+  (0.1ms) RELEASE SAVEPOINT active_record_1
38
+  (0.8ms) rollback transaction
39
+  (0.1ms) begin transaction
40
+ ---------------------------------
41
+ PolymorphicRenderTest: test_truth
42
+ ---------------------------------
43
+  (0.1ms) rollback transaction
44
+  (0.4ms) begin transaction
45
+ ---------------------------------------------------------------
46
+ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
47
+ ---------------------------------------------------------------
48
+  (0.1ms) SAVEPOINT active_record_1
49
+ SQL (2.6ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:07:45 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:07:45 UTC +00:00]]
50
+  (0.1ms) RELEASE SAVEPOINT active_record_1
51
+ Rendered posts/_post.html.erb (2.8ms)
52
+  (0.6ms) rollback transaction
53
+  (0.2ms) begin transaction
54
+ ---------------------------------
55
+ PolymorphicRenderTest: test_truth
56
+ ---------------------------------
57
+  (1.1ms) rollback transaction
58
+  (0.6ms) begin transaction
59
+ ---------------------------------------------------------------
60
+ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
61
+ ---------------------------------------------------------------
62
+  (0.2ms) SAVEPOINT active_record_1
63
+ SQL (2.9ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:08:17 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:08:17 UTC +00:00]]
64
+  (0.1ms) RELEASE SAVEPOINT active_record_1
65
+ Rendered posts/_post.html.erb (1.2ms)
66
+  (1.5ms) rollback transaction
67
+  (0.1ms) begin transaction
68
+ ---------------------------------
69
+ PolymorphicRenderTest: test_truth
70
+ ---------------------------------
71
+  (0.1ms) rollback transaction
72
+  (0.3ms) begin transaction
73
+ ---------------------------------------------------------------
74
+ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
75
+ ---------------------------------------------------------------
76
+  (0.1ms) SAVEPOINT active_record_1
77
+ SQL (2.6ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:08:59 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:08:59 UTC +00:00]]
78
+  (0.2ms) RELEASE SAVEPOINT active_record_1
79
+ Rendered posts/_post.html.erb (1.2ms)
80
+  (2.5ms) rollback transaction
81
+  (0.1ms) begin transaction
82
+ ---------------------------------
83
+ PolymorphicRenderTest: test_truth
84
+ ---------------------------------
85
+  (0.1ms) rollback transaction
86
+  (0.4ms) begin transaction
87
+ --------------------------------------------------------------------------
88
+ PolymorphicRender::ApplicationHelperTest: test_simple_collection_rendering
89
+ --------------------------------------------------------------------------
90
+  (0.1ms) SAVEPOINT active_record_1
91
+ SQL (3.0ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:10:32 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:10:32 UTC +00:00]]
92
+  (0.1ms) RELEASE SAVEPOINT active_record_1
93
+  (0.0ms) SAVEPOINT active_record_1
94
+ SQL (0.4ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:10:32 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Mon, 03 Mar 2014 09:10:32 UTC +00:00]]
95
+  (0.1ms) RELEASE SAVEPOINT active_record_1
96
+ Post Load (0.1ms) SELECT "posts".* FROM "posts"
97
+ Rendered posts/_post.html.erb (0.9ms)
98
+ Rendered posts/_post.html.erb (0.1ms)
99
+  (2.6ms) rollback transaction
100
+  (0.1ms) begin transaction
101
+ ---------------------------------------------------------------
102
+ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
103
+ ---------------------------------------------------------------
104
+  (0.1ms) SAVEPOINT active_record_1
105
+ SQL (0.7ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:10:32 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:10:32 UTC +00:00]]
106
+  (0.1ms) RELEASE SAVEPOINT active_record_1
107
+  (0.1ms) SAVEPOINT active_record_1
108
+ SQL (0.4ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:10:32 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Mon, 03 Mar 2014 09:10:32 UTC +00:00]]
109
+  (0.1ms) RELEASE SAVEPOINT active_record_1
110
+  (0.4ms) rollback transaction
111
+  (0.1ms) begin transaction
112
+ ---------------------------------
113
+ PolymorphicRenderTest: test_truth
114
+ ---------------------------------
115
+  (0.1ms) rollback transaction
116
+  (0.4ms) begin transaction
117
+ --------------------------------------------------------------------------
118
+ PolymorphicRender::ApplicationHelperTest: test_simple_collection_rendering
119
+ --------------------------------------------------------------------------
120
+  (0.1ms) SAVEPOINT active_record_1
121
+ SQL (2.7ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:10:58 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:10:58 UTC +00:00]]
122
+  (0.1ms) RELEASE SAVEPOINT active_record_1
123
+  (0.1ms) SAVEPOINT active_record_1
124
+ SQL (0.5ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:10:58 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Mon, 03 Mar 2014 09:10:58 UTC +00:00]]
125
+  (0.1ms) RELEASE SAVEPOINT active_record_1
126
+ Post Load (0.1ms) SELECT "posts".* FROM "posts"
127
+ Rendered posts/_post.html.erb (0.8ms)
128
+ Rendered posts/_post.html.erb (0.1ms)
129
+  (2.7ms) rollback transaction
130
+  (0.2ms) begin transaction
131
+ ---------------------------------------------------------------
132
+ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
133
+ ---------------------------------------------------------------
134
+  (0.1ms) SAVEPOINT active_record_1
135
+ SQL (0.5ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:10:58 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:10:58 UTC +00:00]]
136
+  (0.1ms) RELEASE SAVEPOINT active_record_1
137
+  (0.0ms) SAVEPOINT active_record_1
138
+ SQL (0.4ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:10:58 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Mon, 03 Mar 2014 09:10:58 UTC +00:00]]
139
+  (0.1ms) RELEASE SAVEPOINT active_record_1
140
+ Rendered posts/_post.html.erb (0.1ms)
141
+  (0.6ms) rollback transaction
142
+  (0.2ms) begin transaction
143
+ ---------------------------------
144
+ PolymorphicRenderTest: test_truth
145
+ ---------------------------------
146
+  (0.1ms) rollback transaction
147
+  (0.3ms) begin transaction
148
+ ------------------------------------------------------------------------------
149
+ PolymorphicRender::ApplicationHelperTest: test_namespaced_collection_rendering
150
+ ------------------------------------------------------------------------------
151
+  (0.1ms) SAVEPOINT active_record_1
152
+ SQL (2.7ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00]]
153
+  (0.1ms) RELEASE SAVEPOINT active_record_1
154
+  (0.0ms) SAVEPOINT active_record_1
155
+ SQL (0.4ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00]]
156
+  (0.0ms) RELEASE SAVEPOINT active_record_1
157
+ Post Load (0.1ms) SELECT "posts".* FROM "posts"
158
+ Rendered posts/_post_admin.html.erb (0.7ms)
159
+ Rendered posts/_post_admin.html.erb (0.1ms)
160
+  (1.6ms) rollback transaction
161
+  (0.1ms) begin transaction
162
+ -------------------------------------------------------------------
163
+ PolymorphicRender::ApplicationHelperTest: test_namespaced_rendering
164
+ -------------------------------------------------------------------
165
+  (0.1ms) SAVEPOINT active_record_1
166
+ SQL (0.5ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00]]
167
+  (0.1ms) RELEASE SAVEPOINT active_record_1
168
+  (0.0ms) SAVEPOINT active_record_1
169
+ SQL (0.4ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00]]
170
+  (0.1ms) RELEASE SAVEPOINT active_record_1
171
+ Rendered posts/_post_admin.html.erb (0.1ms)
172
+  (0.5ms) rollback transaction
173
+  (0.1ms) begin transaction
174
+ --------------------------------------------------------------------------
175
+ PolymorphicRender::ApplicationHelperTest: test_simple_collection_rendering
176
+ --------------------------------------------------------------------------
177
+  (0.1ms) SAVEPOINT active_record_1
178
+ SQL (0.6ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00]]
179
+  (0.1ms) RELEASE SAVEPOINT active_record_1
180
+  (0.1ms) SAVEPOINT active_record_1
181
+ SQL (0.6ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00]]
182
+  (0.1ms) RELEASE SAVEPOINT active_record_1
183
+ Post Load (0.1ms) SELECT "posts".* FROM "posts"
184
+ Rendered posts/_post.html.erb (0.9ms)
185
+ Rendered posts/_post.html.erb (0.2ms)
186
+  (0.6ms) rollback transaction
187
+  (0.1ms) begin transaction
188
+ ---------------------------------------------------------------
189
+ PolymorphicRender::ApplicationHelperTest: test_simple_rendering
190
+ ---------------------------------------------------------------
191
+  (0.1ms) SAVEPOINT active_record_1
192
+ SQL (0.5ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00], ["title", "My First Post"], ["updated_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00]]
193
+  (0.1ms) RELEASE SAVEPOINT active_record_1
194
+  (0.0ms) SAVEPOINT active_record_1
195
+ SQL (0.3ms) INSERT INTO "posts" ("created_at", "title", "updated_at") VALUES (?, ?, ?) [["created_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00], ["title", "I am Blogger!"], ["updated_at", Mon, 03 Mar 2014 09:13:28 UTC +00:00]]
196
+  (0.1ms) RELEASE SAVEPOINT active_record_1
197
+ Rendered posts/_post.html.erb (0.1ms)
198
+  (0.6ms) rollback transaction
199
+  (0.1ms) begin transaction
200
+ ---------------------------------
201
+ PolymorphicRenderTest: test_truth
202
+ ---------------------------------
203
+  (0.1ms) rollback transaction
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,7 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+ one:
4
+ title: MyString
5
+
6
+ two:
7
+ title: MyString
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PostTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ class PolymorphicRender::ApplicationHelperTest < ActionView::TestCase
4
+ include PolymorphicRender::ApplicationHelper
5
+
6
+ setup do
7
+ @post1 = Post.create title: 'My First Post'
8
+ @post2 = Post.create title: 'I am Blogger!'
9
+ end
10
+
11
+ test 'simple rendering' do
12
+ assert_equal "Title: My First Post\n", polymorphic_render(@post1)
13
+ end
14
+
15
+ test 'simple collection rendering' do
16
+ assert_equal "Title: My First Post\nTitle: I am Blogger!\n", polymorphic_render(Post.all)
17
+ end
18
+
19
+ test 'namespaced rendering' do
20
+ assert_equal "Edit: My First Post\n", polymorphic_render(@post1, :admin)
21
+ end
22
+
23
+ test 'namespaced collection rendering' do
24
+ assert_equal "Edit: My First Post\nEdit: I am Blogger!\n", polymorphic_render(Post.all, :admin)
25
+ end
26
+ end
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActionDispatch::IntegrationTest
4
+ fixtures :all
5
+
6
+ # test "the truth" do
7
+ # assert true
8
+ # end
9
+ end
10
+
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class PolymorphicRenderTest < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, PolymorphicRender
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+ # Load fixtures from the engine
13
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
14
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
15
+ end