hash_ids 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/{LICENSE.txt → MIT-LICENSE} +1 -3
  3. data/Rakefile +23 -4
  4. data/lib/hash_ids/obfuscate.rb +6 -5
  5. data/lib/hash_ids/version.rb +1 -1
  6. data/lib/hash_ids.rb +1 -0
  7. data/lib/tasks/hash_ids_tasks.rake +4 -0
  8. data/spec/dummy/README.rdoc +28 -0
  9. data/spec/dummy/Rakefile +6 -0
  10. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  11. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  12. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  13. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  14. data/spec/dummy/app/models/user.rb +3 -0
  15. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  16. data/spec/dummy/bin/bundle +3 -0
  17. data/spec/dummy/bin/rails +4 -0
  18. data/spec/dummy/bin/rake +4 -0
  19. data/spec/dummy/bin/setup +29 -0
  20. data/spec/dummy/config/application.rb +32 -0
  21. data/spec/dummy/config/boot.rb +5 -0
  22. data/spec/dummy/config/database.yml +25 -0
  23. data/spec/dummy/config/environment.rb +5 -0
  24. data/spec/dummy/config/environments/development.rb +41 -0
  25. data/spec/dummy/config/environments/production.rb +79 -0
  26. data/spec/dummy/config/environments/test.rb +42 -0
  27. data/spec/dummy/config/initializers/assets.rb +11 -0
  28. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  29. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  30. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  31. data/spec/dummy/config/initializers/inflections.rb +16 -0
  32. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  33. data/spec/dummy/config/initializers/session_store.rb +3 -0
  34. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  35. data/spec/dummy/config/locales/en.yml +23 -0
  36. data/spec/dummy/config/routes.rb +57 -0
  37. data/spec/dummy/config/secrets.yml +22 -0
  38. data/spec/dummy/config.ru +4 -0
  39. data/spec/dummy/db/development.sqlite3 +0 -0
  40. data/spec/dummy/db/migrate/20150204045322_create_users.rb +10 -0
  41. data/spec/dummy/db/schema.rb +23 -0
  42. data/spec/dummy/db/test.sqlite3 +0 -0
  43. data/spec/dummy/log/development.log +16 -0
  44. data/spec/dummy/log/test.log +125 -0
  45. data/spec/dummy/public/404.html +67 -0
  46. data/spec/dummy/public/422.html +67 -0
  47. data/spec/dummy/public/500.html +66 -0
  48. data/spec/dummy/public/favicon.ico +0 -0
  49. data/spec/models/user_spec.rb +31 -0
  50. data/spec/spec_helper.rb +17 -0
  51. data/spec/views/users_routes_spec.rb +19 -0
  52. metadata +100 -21
  53. data/.gitignore +0 -14
  54. data/.rspec +0 -2
  55. data/.travis.yml +0 -3
  56. data/Gemfile +0 -5
  57. data/README.md +0 -60
  58. data/hash_ids.gemspec +0 -25
  59. data/spec/hash_ids_spec.rb +0 -55
@@ -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: f69d6b689a3335877f4342851dd07b46432f6bf38718cecd92629e19f754dbe57822cec989677dbf86a4640d8eef42a047059a4cc9a6e5c3655ca56531912f72
15
+
16
+ test:
17
+ secret_key_base: 7334349326931028fc8ea4a566aeb8a6b468bafaebaf3c6f4c19290dad9a6c22233d4ca46ff28251a151a46425aa9e0e79de3aa2fa4c95e659ee5426467321cb
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"] %>
@@ -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
Binary file
@@ -0,0 +1,10 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :name
5
+ t.integer :age
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,23 @@
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: 20150204045322) do
15
+
16
+ create_table "users", force: :cascade do |t|
17
+ t.string "name"
18
+ t.integer "age"
19
+ t.datetime "created_at", null: false
20
+ t.datetime "updated_at", null: false
21
+ end
22
+
23
+ end
Binary file
@@ -0,0 +1,16 @@
1
+  (145.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2
+  (0.1ms) select sqlite_version(*)
3
+  (132.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
+ Migrating to CreateUsers (20150204045322)
6
+  (0.1ms) begin transaction
7
+  (0.7ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "age" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
8
+ SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150204045322"]]
9
+  (136.9ms) commit transaction
10
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
11
+  (115.7ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "age" integer, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) 
12
+  (126.2ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL)
13
+  (0.1ms) select sqlite_version(*)
14
+  (132.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
15
+  (0.2ms) SELECT version FROM "schema_migrations"
16
+  (124.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150204045322')
@@ -0,0 +1,125 @@
1
+  (0.1ms) begin transaction
2
+ SQL (0.4ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "gqyp"], ["age", 55], ["created_at", "2015-02-04 06:23:41.652374"], ["updated_at", "2015-02-04 06:23:41.652374"]]
3
+  (124.9ms) commit transaction
4
+  (0.1ms) begin transaction
5
+  (0.1ms) rollback transaction
6
+  (0.1ms) begin transaction
7
+  (0.2ms) rollback transaction
8
+  (0.1ms) begin transaction
9
+ SQL (0.4ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "akwf"], ["age", 41], ["created_at", "2015-02-04 06:23:41.790383"], ["updated_at", "2015-02-04 06:23:41.790383"]]
10
+  (122.1ms) commit transaction
11
+  (0.1ms) begin transaction
12
+ SQL (0.3ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "akwf"], ["age", 98], ["created_at", "2015-02-04 06:23:41.915735"], ["updated_at", "2015-02-04 06:23:41.915735"]]
13
+  (164.3ms) commit transaction
14
+  (0.1ms) begin transaction
15
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 3]]
16
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 3]]
17
+  (0.1ms) rollback transaction
18
+  (0.1ms) begin transaction
19
+  (0.1ms) rollback transaction
20
+  (0.1ms) begin transaction
21
+ User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (2, 3)
22
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (2, 3)
23
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (2, 3)
24
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (2, 3)
25
+  (0.1ms) rollback transaction
26
+  (0.1ms) begin transaction
27
+ SQL (0.4ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "pktg"], ["age", 15], ["created_at", "2015-02-04 06:30:33.725892"], ["updated_at", "2015-02-04 06:30:33.725892"]]
28
+  (156.7ms) commit transaction
29
+  (0.1ms) begin transaction
30
+  (0.1ms) rollback transaction
31
+  (0.1ms) begin transaction
32
+  (0.1ms) rollback transaction
33
+  (0.1ms) begin transaction
34
+ SQL (0.3ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "wzrg"], ["age", 81], ["created_at", "2015-02-04 06:30:33.894656"], ["updated_at", "2015-02-04 06:30:33.894656"]]
35
+  (140.6ms) commit transaction
36
+  (0.1ms) begin transaction
37
+ SQL (0.3ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "wzrg"], ["age", 40], ["created_at", "2015-02-04 06:30:34.037976"], ["updated_at", "2015-02-04 06:30:34.037976"]]
38
+  (139.2ms) commit transaction
39
+  (0.1ms) begin transaction
40
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 6]]
41
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 6]]
42
+  (0.1ms) rollback transaction
43
+  (0.1ms) begin transaction
44
+ User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (5, 6)
45
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (5, 6)
46
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (5, 6)
47
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (5, 6)
48
+  (0.1ms) rollback transaction
49
+  (0.1ms) begin transaction
50
+  (0.1ms) rollback transaction
51
+  (0.1ms) begin transaction
52
+ SQL (0.4ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "heig"], ["age", 14], ["created_at", "2015-02-04 06:30:41.102233"], ["updated_at", "2015-02-04 06:30:41.102233"]]
53
+  (125.7ms) commit transaction
54
+  (0.1ms) begin transaction
55
+  (0.1ms) rollback transaction
56
+  (0.1ms) begin transaction
57
+  (0.1ms) rollback transaction
58
+  (0.1ms) begin transaction
59
+ SQL (0.3ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "sial"], ["age", 71], ["created_at", "2015-02-04 06:30:41.238867"], ["updated_at", "2015-02-04 06:30:41.238867"]]
60
+  (141.7ms) commit transaction
61
+  (0.1ms) begin transaction
62
+ SQL (0.3ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "sial"], ["age", 14], ["created_at", "2015-02-04 06:30:41.383032"], ["updated_at", "2015-02-04 06:30:41.383032"]]
63
+  (123.2ms) commit transaction
64
+  (0.1ms) begin transaction
65
+  (0.2ms) rollback transaction
66
+  (0.1ms) begin transaction
67
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 9]]
68
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 9]]
69
+  (0.1ms) rollback transaction
70
+  (0.1ms) begin transaction
71
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (8, 9)
72
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (8, 9)
73
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (8, 9)
74
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (8, 9)
75
+  (0.1ms) rollback transaction
76
+  (0.1ms) begin transaction
77
+ SQL (0.5ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "azkm"], ["age", 62], ["created_at", "2015-02-04 06:41:33.364103"], ["updated_at", "2015-02-04 06:41:33.364103"]]
78
+  (145.6ms) commit transaction
79
+  (0.1ms) begin transaction
80
+  (0.1ms) rollback transaction
81
+  (0.1ms) begin transaction
82
+  (0.1ms) rollback transaction
83
+  (0.1ms) begin transaction
84
+ SQL (0.3ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "jkgt"], ["age", 69], ["created_at", "2015-02-04 06:41:33.521292"], ["updated_at", "2015-02-04 06:41:33.521292"]]
85
+  (150.5ms) commit transaction
86
+  (0.1ms) begin transaction
87
+ SQL (0.3ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "jkgt"], ["age", 57], ["created_at", "2015-02-04 06:41:33.674588"], ["updated_at", "2015-02-04 06:41:33.674588"]]
88
+  (139.7ms) commit transaction
89
+  (0.1ms) begin transaction
90
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 12]]
91
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 12]]
92
+  (0.1ms) rollback transaction
93
+  (0.1ms) begin transaction
94
+  (0.1ms) rollback transaction
95
+  (0.1ms) begin transaction
96
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (11, 12)
97
+ User Load (0.4ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (11, 12)
98
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (11, 12)
99
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (11, 12)
100
+  (0.1ms) rollback transaction
101
+  (0.1ms) begin transaction
102
+ SQL (0.5ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "jpal"], ["age", 93], ["created_at", "2015-02-04 06:53:33.481151"], ["updated_at", "2015-02-04 06:53:33.481151"]]
103
+  (122.0ms) commit transaction
104
+  (0.1ms) begin transaction
105
+ SQL (0.3ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "jpal"], ["age", 67], ["created_at", "2015-02-04 06:53:33.608658"], ["updated_at", "2015-02-04 06:53:33.608658"]]
106
+  (130.6ms) commit transaction
107
+  (0.1ms) begin transaction
108
+  (0.1ms) rollback transaction
109
+  (0.1ms) begin transaction
110
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 14]]
111
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 14]]
112
+  (0.2ms) rollback transaction
113
+  (0.1ms) begin transaction
114
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (13, 14)
115
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (13, 14)
116
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (13, 14)
117
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" IN (13, 14)
118
+  (0.1ms) rollback transaction
119
+  (0.1ms) begin transaction
120
+ SQL (0.3ms) INSERT INTO "users" ("name", "age", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "xsjt"], ["age", 28], ["created_at", "2015-02-04 06:53:33.774392"], ["updated_at", "2015-02-04 06:53:33.774392"]]
121
+  (148.9ms) commit transaction
122
+  (0.1ms) begin transaction
123
+  (0.1ms) rollback transaction
124
+  (0.1ms) begin transaction
125
+  (0.1ms) rollback transaction
@@ -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,31 @@
1
+ # coding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe 'User model' do
5
+ before :all do
6
+ @name = ('a'..'z').to_a.sample(4).join ''
7
+ @user_jim = User.create name: @name, :age => Random.new.rand(10..100)
8
+ @user_tom = User.create name: @name, :age => Random.new.rand(10..100)
9
+ end
10
+
11
+ it 'hashable' do
12
+ hash = @user_jim.to_param
13
+ expect(@user_jim.id).to eq User.hash_ids_decode(hash).first
14
+ end
15
+
16
+ it '#find single' do
17
+ id = @user_tom.id
18
+ hash_id = @user_tom.to_param
19
+
20
+ expect(User.find(hash_id)).to eq User.find(id)
21
+ end
22
+
23
+ it '#find multiple' do
24
+ ids = [@user_jim.id, @user_tom.id]
25
+ hash_ids = [@user_jim.to_param, @user_tom.to_param]
26
+
27
+ expect(User.find(ids)).to eq User.find(hash_ids)
28
+ expect(User.find(ids.first, ids.last)).to eq User.find(hash_ids.first, hash_ids.last)
29
+ end
30
+
31
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,19 @@
1
+ # coding: utf-8
1
2
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
3
  require 'hash_ids'
4
+
5
+ ENV['RAILS_ENV'] ||= 'test'
6
+
7
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
8
+ require 'rspec/rails'
9
+
10
+ Rails.backtrace_cleaner.remove_silencers!
11
+
12
+ RSpec.configure do |config|
13
+ config.include Rails.application.routes.url_helpers
14
+
15
+ config.mock_with :rspec
16
+ config.use_transactional_fixtures = true
17
+ config.infer_base_class_for_anonymous_controllers = false
18
+ config.order = "random"
19
+ end
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+ require 'spec_helper'
3
+
4
+ describe 'User routes' do
5
+ before :all do
6
+ @name = ('a'..'z').to_a.sample(4).join ''
7
+ @user_jim = User.create name: @name, :age => Random.new.rand(10..100)
8
+ end
9
+
10
+ it 'user show path' do
11
+ path = user_path @user_jim
12
+ expect(path).to eq "/users/#{@user_jim.to_param}"
13
+ end
14
+
15
+ it 'use edit path' do
16
+ path = edit_user_path @user_jim
17
+ expect(path).to eq "/users/#{@user_jim.to_param}/edit"
18
+ end
19
+ end