introspective_grape 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +35 -0
  4. data/Gemfile +15 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +103 -0
  7. data/Rakefile +26 -0
  8. data/app/assets/images/introspective_grape/.keep +0 -0
  9. data/app/assets/stylesheets/introspective_grape/.keep +0 -0
  10. data/app/controllers/.keep +0 -0
  11. data/app/helpers/.keep +0 -0
  12. data/app/mailers/.keep +0 -0
  13. data/app/models/.keep +0 -0
  14. data/app/views/.keep +0 -0
  15. data/bin/rails +12 -0
  16. data/introspective_grape.gemspec +49 -0
  17. data/lib/introspective_grape/api.rb +445 -0
  18. data/lib/introspective_grape/camel_snake.rb +71 -0
  19. data/lib/introspective_grape/version.rb +3 -0
  20. data/lib/introspective_grape.rb +4 -0
  21. data/lib/tasks/introspective_grape_tasks.rake +4 -0
  22. data/spec/dummy/Gemfile +4 -0
  23. data/spec/dummy/README.rdoc +28 -0
  24. data/spec/dummy/Rakefile +6 -0
  25. data/spec/dummy/app/api/active_record_helpers.rb +17 -0
  26. data/spec/dummy/app/api/api_helpers.rb +36 -0
  27. data/spec/dummy/app/api/dummy/chat_api.rb +108 -0
  28. data/spec/dummy/app/api/dummy/company_api.rb +8 -0
  29. data/spec/dummy/app/api/dummy/entities.rb +25 -0
  30. data/spec/dummy/app/api/dummy/location_api.rb +37 -0
  31. data/spec/dummy/app/api/dummy/project_api.rb +51 -0
  32. data/spec/dummy/app/api/dummy/role_api.rb +7 -0
  33. data/spec/dummy/app/api/dummy/sessions.rb +55 -0
  34. data/spec/dummy/app/api/dummy/user_api.rb +32 -0
  35. data/spec/dummy/app/api/dummy_api.rb +57 -0
  36. data/spec/dummy/app/api/error_handlers.rb +28 -0
  37. data/spec/dummy/app/api/permissions_helper.rb +7 -0
  38. data/spec/dummy/app/assets/images/.keep +0 -0
  39. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  40. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  41. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  42. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  43. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  44. data/spec/dummy/app/mailers/.keep +0 -0
  45. data/spec/dummy/app/models/.keep +0 -0
  46. data/spec/dummy/app/models/abstract_adapter.rb +13 -0
  47. data/spec/dummy/app/models/admin_user.rb +6 -0
  48. data/spec/dummy/app/models/chat.rb +18 -0
  49. data/spec/dummy/app/models/chat_message.rb +34 -0
  50. data/spec/dummy/app/models/chat_message_user.rb +17 -0
  51. data/spec/dummy/app/models/chat_user.rb +16 -0
  52. data/spec/dummy/app/models/company.rb +14 -0
  53. data/spec/dummy/app/models/concerns/.keep +0 -0
  54. data/spec/dummy/app/models/image.rb +21 -0
  55. data/spec/dummy/app/models/job.rb +10 -0
  56. data/spec/dummy/app/models/locatable.rb +6 -0
  57. data/spec/dummy/app/models/location.rb +26 -0
  58. data/spec/dummy/app/models/location_beacon.rb +16 -0
  59. data/spec/dummy/app/models/location_gps.rb +14 -0
  60. data/spec/dummy/app/models/project.rb +20 -0
  61. data/spec/dummy/app/models/project_job.rb +7 -0
  62. data/spec/dummy/app/models/role.rb +30 -0
  63. data/spec/dummy/app/models/super_user.rb +11 -0
  64. data/spec/dummy/app/models/team.rb +9 -0
  65. data/spec/dummy/app/models/team_user.rb +13 -0
  66. data/spec/dummy/app/models/user/chatter.rb +79 -0
  67. data/spec/dummy/app/models/user.rb +84 -0
  68. data/spec/dummy/app/models/user_location.rb +28 -0
  69. data/spec/dummy/app/models/user_project_job.rb +16 -0
  70. data/spec/dummy/app/policies/application_policy.rb +47 -0
  71. data/spec/dummy/app/policies/chat_policy.rb +22 -0
  72. data/spec/dummy/app/policies/company_policy.rb +32 -0
  73. data/spec/dummy/app/policies/location_policy.rb +29 -0
  74. data/spec/dummy/app/policies/project_policy.rb +42 -0
  75. data/spec/dummy/app/policies/role_policy.rb +33 -0
  76. data/spec/dummy/app/policies/user_location_policy.rb +12 -0
  77. data/spec/dummy/app/policies/user_policy.rb +8 -0
  78. data/spec/dummy/app/views/layouts/application.html.erb +13 -0
  79. data/spec/dummy/bin/bundle +3 -0
  80. data/spec/dummy/bin/rails +4 -0
  81. data/spec/dummy/bin/rake +4 -0
  82. data/spec/dummy/bin/setup +29 -0
  83. data/spec/dummy/config/application.rb +38 -0
  84. data/spec/dummy/config/boot.rb +6 -0
  85. data/spec/dummy/config/database.yml +23 -0
  86. data/spec/dummy/config/environment.rb +11 -0
  87. data/spec/dummy/config/environments/development.rb +41 -0
  88. data/spec/dummy/config/environments/production.rb +79 -0
  89. data/spec/dummy/config/environments/test.rb +43 -0
  90. data/spec/dummy/config/initializers/assets.rb +11 -0
  91. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  92. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  93. data/spec/dummy/config/initializers/devise.rb +262 -0
  94. data/spec/dummy/config/initializers/devise_async.rb +2 -0
  95. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  96. data/spec/dummy/config/initializers/inflections.rb +16 -0
  97. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  98. data/spec/dummy/config/initializers/paperclip.rb +13 -0
  99. data/spec/dummy/config/initializers/paperclip_adapter.rb +13 -0
  100. data/spec/dummy/config/initializers/session_store.rb +3 -0
  101. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  102. data/spec/dummy/config/locales/devise.en.yml +60 -0
  103. data/spec/dummy/config/locales/en.yml +23 -0
  104. data/spec/dummy/config/routes.rb +8 -0
  105. data/spec/dummy/config/secrets.yml +22 -0
  106. data/spec/dummy/config.ru +4 -0
  107. data/spec/dummy/db/migrate/20141002205024_devise_create_users.rb +42 -0
  108. data/spec/dummy/db/migrate/20141002211055_devise_create_admin_users.rb +48 -0
  109. data/spec/dummy/db/migrate/20141002211057_create_active_admin_comments.rb +19 -0
  110. data/spec/dummy/db/migrate/20141002220722_add_lockable_to_users.rb +8 -0
  111. data/spec/dummy/db/migrate/20150406213646_create_companies.rb +11 -0
  112. data/spec/dummy/db/migrate/20150414213154_add_user_authentication_token.rb +11 -0
  113. data/spec/dummy/db/migrate/20150415222005_create_roles.rb +12 -0
  114. data/spec/dummy/db/migrate/20150505181635_create_chats.rb +9 -0
  115. data/spec/dummy/db/migrate/20150505181636_create_chat_users.rb +11 -0
  116. data/spec/dummy/db/migrate/20150505181640_create_chat_messages.rb +11 -0
  117. data/spec/dummy/db/migrate/20150507191529_create_chat_message_users.rb +11 -0
  118. data/spec/dummy/db/migrate/20150601200526_create_locations.rb +12 -0
  119. data/spec/dummy/db/migrate/20150601200533_create_locatables.rb +10 -0
  120. data/spec/dummy/db/migrate/20150601212924_create_location_beacons.rb +15 -0
  121. data/spec/dummy/db/migrate/20150601213542_create_location_gps.rb +12 -0
  122. data/spec/dummy/db/migrate/20150609201823_create_user_locations.rb +14 -0
  123. data/spec/dummy/db/migrate/20150616205336_add_role_user_constraint.rb +9 -0
  124. data/spec/dummy/db/migrate/20150617232519_create_projects.rb +10 -0
  125. data/spec/dummy/db/migrate/20150617232521_create_jobs.rb +9 -0
  126. data/spec/dummy/db/migrate/20150617232522_create_project_jobs.rb +11 -0
  127. data/spec/dummy/db/migrate/20150623170133_create_user_project_jobs.rb +12 -0
  128. data/spec/dummy/db/migrate/20150701234929_create_teams.rb +11 -0
  129. data/spec/dummy/db/migrate/20150701234930_create_team_users.rb +11 -0
  130. data/spec/dummy/db/migrate/20150727214950_add_confirmable_to_devise.rb +11 -0
  131. data/spec/dummy/db/migrate/20150820190524_add_user_names.rb +6 -0
  132. data/spec/dummy/db/migrate/20150824215701_create_images.rb +15 -0
  133. data/spec/dummy/db/migrate/20150909225019_add_password_to_project.rb +5 -0
  134. data/spec/dummy/db/schema.rb +278 -0
  135. data/spec/dummy/lib/assets/.keep +0 -0
  136. data/spec/dummy/log/.keep +0 -0
  137. data/spec/dummy/public/404.html +67 -0
  138. data/spec/dummy/public/422.html +67 -0
  139. data/spec/dummy/public/500.html +66 -0
  140. data/spec/dummy/public/favicon.ico +0 -0
  141. data/spec/fixtures/images/avatar.jpeg +0 -0
  142. data/spec/fixtures/images/exif.jpeg +0 -0
  143. data/spec/models/chat_spec.rb +32 -0
  144. data/spec/models/image_spec.rb +14 -0
  145. data/spec/models/locatable_spec.rb +10 -0
  146. data/spec/models/project_spec.rb +17 -0
  147. data/spec/models/role_spec.rb +63 -0
  148. data/spec/models/team_spec.rb +17 -0
  149. data/spec/models/team_user_spec.rb +20 -0
  150. data/spec/models/user_location_spec.rb +35 -0
  151. data/spec/models/user_project_job_spec.rb +30 -0
  152. data/spec/models/user_spec.rb +125 -0
  153. data/spec/rails_helper.rb +23 -0
  154. data/spec/requests/chat_api_spec.rb +174 -0
  155. data/spec/requests/company_api_spec.rb +61 -0
  156. data/spec/requests/location_api_spec.rb +96 -0
  157. data/spec/requests/project_api_spec.rb +151 -0
  158. data/spec/requests/role_api_spec.rb +37 -0
  159. data/spec/requests/sessions_api_spec.rb +55 -0
  160. data/spec/requests/user_api_spec.rb +191 -0
  161. data/spec/support/blueprints.rb +103 -0
  162. data/spec/support/location_helper.rb +56 -0
  163. data/spec/support/pundit_helpers.rb +13 -0
  164. data/spec/support/request_helpers.rb +22 -0
  165. metadata +562 -0
@@ -0,0 +1,278 @@
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: 20150909225019) do
15
+
16
+ create_table "active_admin_comments", force: :cascade do |t|
17
+ t.string "namespace"
18
+ t.text "body"
19
+ t.string "resource_id", null: false
20
+ t.string "resource_type", null: false
21
+ t.integer "author_id"
22
+ t.string "author_type"
23
+ t.datetime "created_at", null: false
24
+ t.datetime "updated_at", null: false
25
+ end
26
+
27
+ add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id"
28
+ add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace"
29
+ add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id"
30
+
31
+ create_table "admin_users", force: :cascade do |t|
32
+ t.string "email", default: "", null: false
33
+ t.string "encrypted_password", default: "", null: false
34
+ t.string "reset_password_token"
35
+ t.datetime "reset_password_sent_at"
36
+ t.datetime "remember_created_at"
37
+ t.integer "sign_in_count", default: 0, null: false
38
+ t.datetime "current_sign_in_at"
39
+ t.datetime "last_sign_in_at"
40
+ t.string "current_sign_in_ip"
41
+ t.string "last_sign_in_ip"
42
+ t.datetime "created_at", null: false
43
+ t.datetime "updated_at", null: false
44
+ end
45
+
46
+ add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true
47
+ add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
48
+
49
+ create_table "chat_message_users", force: :cascade do |t|
50
+ t.integer "chat_message_id"
51
+ t.integer "user_id"
52
+ t.datetime "read_at"
53
+ t.datetime "created_at", null: false
54
+ t.datetime "updated_at", null: false
55
+ end
56
+
57
+ add_index "chat_message_users", ["chat_message_id"], name: "index_chat_message_users_on_chat_message_id"
58
+ add_index "chat_message_users", ["user_id"], name: "index_chat_message_users_on_user_id"
59
+
60
+ create_table "chat_messages", force: :cascade do |t|
61
+ t.integer "chat_id"
62
+ t.integer "author_id"
63
+ t.text "message"
64
+ t.datetime "created_at", null: false
65
+ t.datetime "updated_at", null: false
66
+ end
67
+
68
+ add_index "chat_messages", ["author_id"], name: "index_chat_messages_on_author_id"
69
+ add_index "chat_messages", ["chat_id"], name: "index_chat_messages_on_chat_id"
70
+
71
+ create_table "chat_users", force: :cascade do |t|
72
+ t.integer "chat_id"
73
+ t.integer "user_id"
74
+ t.datetime "departed_at"
75
+ t.datetime "created_at", null: false
76
+ t.datetime "updated_at", null: false
77
+ end
78
+
79
+ add_index "chat_users", ["chat_id"], name: "index_chat_users_on_chat_id"
80
+ add_index "chat_users", ["user_id"], name: "index_chat_users_on_user_id"
81
+
82
+ create_table "chats", force: :cascade do |t|
83
+ t.integer "creator_id"
84
+ t.datetime "created_at", null: false
85
+ t.datetime "updated_at", null: false
86
+ end
87
+
88
+ create_table "companies", force: :cascade do |t|
89
+ t.string "name", limit: 256, null: false
90
+ t.string "short_name", limit: 10, null: false
91
+ t.datetime "created_at", null: false
92
+ t.datetime "updated_at", null: false
93
+ end
94
+
95
+ add_index "companies", ["name"], name: "index_companies_on_name", unique: true
96
+
97
+ create_table "images", force: :cascade do |t|
98
+ t.integer "imageable_id"
99
+ t.string "imageable_type"
100
+ t.string "file_file_name"
101
+ t.string "file_content_type"
102
+ t.integer "file_file_size"
103
+ t.datetime "file_updated_at"
104
+ t.boolean "file_processing", default: false, null: false
105
+ t.text "meta"
106
+ t.string "source"
107
+ t.float "lat"
108
+ t.float "lng"
109
+ t.datetime "taken_at"
110
+ t.datetime "created_at", null: false
111
+ t.datetime "updated_at", null: false
112
+ end
113
+
114
+ create_table "jobs", force: :cascade do |t|
115
+ t.string "title", null: false
116
+ t.datetime "created_at", null: false
117
+ t.datetime "updated_at", null: false
118
+ end
119
+
120
+ create_table "locatables", force: :cascade do |t|
121
+ t.integer "location_id"
122
+ t.integer "locatable_id"
123
+ t.string "locatable_type"
124
+ t.datetime "created_at", null: false
125
+ t.datetime "updated_at", null: false
126
+ end
127
+
128
+ add_index "locatables", ["locatable_type", "locatable_id"], name: "index_locatables_on_locatable_type_and_locatable_id"
129
+
130
+ create_table "location_beacons", force: :cascade do |t|
131
+ t.integer "location_id"
132
+ t.integer "company_id", null: false
133
+ t.string "mac_address", limit: 12
134
+ t.string "uuid", limit: 32, null: false
135
+ t.integer "major", null: false
136
+ t.integer "minor", null: false
137
+ t.datetime "created_at", null: false
138
+ t.datetime "updated_at", null: false
139
+ end
140
+
141
+ add_index "location_beacons", ["company_id", "uuid", "major", "minor"], name: "index_location_beacons_unique_company_identifier", unique: true
142
+
143
+ create_table "location_gps", force: :cascade do |t|
144
+ t.integer "location_id"
145
+ t.float "lat", null: false
146
+ t.float "lng", null: false
147
+ t.float "alt", default: 0.0
148
+ t.datetime "created_at", null: false
149
+ t.datetime "updated_at", null: false
150
+ end
151
+
152
+ add_index "location_gps", ["location_id"], name: "index_location_gps_on_location_id"
153
+
154
+ create_table "locations", force: :cascade do |t|
155
+ t.string "name", null: false
156
+ t.string "kind"
157
+ t.integer "parent_location_id"
158
+ t.datetime "created_at", null: false
159
+ t.datetime "updated_at", null: false
160
+ end
161
+
162
+ add_index "locations", ["parent_location_id", "kind", "name"], name: "index_locations_on_parent_location_id_and_kind_and_name", unique: true
163
+ add_index "locations", ["parent_location_id"], name: "index_locations_on_parent_location_id"
164
+
165
+ create_table "project_jobs", force: :cascade do |t|
166
+ t.integer "project_id", null: false
167
+ t.integer "job_id", null: false
168
+ t.datetime "created_at", null: false
169
+ t.datetime "updated_at", null: false
170
+ end
171
+
172
+ add_index "project_jobs", ["job_id"], name: "index_project_jobs_on_job_id"
173
+ add_index "project_jobs", ["project_id", "job_id"], name: "index_project_jobs_on_project_id_and_job_id", unique: true
174
+ add_index "project_jobs", ["project_id"], name: "index_project_jobs_on_project_id"
175
+
176
+ create_table "projects", force: :cascade do |t|
177
+ t.string "name", null: false
178
+ t.integer "owner_id"
179
+ t.datetime "created_at", null: false
180
+ t.datetime "updated_at", null: false
181
+ t.string "default_password"
182
+ end
183
+
184
+ add_index "projects", ["owner_id"], name: "index_projects_on_owner_id"
185
+
186
+ create_table "roles", force: :cascade do |t|
187
+ t.integer "user_id", null: false
188
+ t.integer "ownable_id"
189
+ t.string "ownable_type"
190
+ t.datetime "created_at", null: false
191
+ t.datetime "updated_at", null: false
192
+ end
193
+
194
+ add_index "roles", ["ownable_type", "ownable_id"], name: "index_roles_on_ownable_type_and_ownable_id"
195
+ add_index "roles", ["user_id", "ownable_type", "ownable_id"], name: "index_roles_on_user_id_and_ownable_type_and_ownable_id", unique: true
196
+
197
+ create_table "team_users", force: :cascade do |t|
198
+ t.integer "user_id"
199
+ t.integer "team_id"
200
+ t.datetime "created_at", null: false
201
+ t.datetime "updated_at", null: false
202
+ end
203
+
204
+ add_index "team_users", ["team_id"], name: "index_team_users_on_team_id"
205
+ add_index "team_users", ["user_id", "team_id"], name: "index_team_users_on_user_id_and_team_id", unique: true
206
+ add_index "team_users", ["user_id"], name: "index_team_users_on_user_id"
207
+
208
+ create_table "teams", force: :cascade do |t|
209
+ t.string "name"
210
+ t.integer "project_id"
211
+ t.integer "creator_id"
212
+ t.datetime "created_at", null: false
213
+ t.datetime "updated_at", null: false
214
+ end
215
+
216
+ add_index "teams", ["creator_id"], name: "index_teams_on_creator_id"
217
+ add_index "teams", ["project_id"], name: "index_teams_on_project_id"
218
+
219
+ create_table "user_locations", force: :cascade do |t|
220
+ t.integer "user_id"
221
+ t.integer "location_id"
222
+ t.integer "detectable_id"
223
+ t.string "detectable_type"
224
+ t.float "lat"
225
+ t.float "lng"
226
+ t.float "alt"
227
+ t.datetime "created_at", null: false
228
+ t.datetime "updated_at", null: false
229
+ end
230
+
231
+ add_index "user_locations", ["detectable_type", "detectable_id"], name: "index_user_locations_on_detectable_type_and_detectable_id"
232
+ add_index "user_locations", ["location_id"], name: "index_user_locations_on_location_id"
233
+ add_index "user_locations", ["user_id"], name: "index_user_locations_on_user_id"
234
+
235
+ create_table "user_project_jobs", force: :cascade do |t|
236
+ t.integer "user_id", null: false
237
+ t.integer "project_id", null: false
238
+ t.integer "job_id", null: false
239
+ t.datetime "created_at", null: false
240
+ t.datetime "updated_at", null: false
241
+ end
242
+
243
+ add_index "user_project_jobs", ["job_id"], name: "index_user_project_jobs_on_job_id"
244
+ add_index "user_project_jobs", ["project_id"], name: "index_user_project_jobs_on_project_id"
245
+ add_index "user_project_jobs", ["user_id", "project_id", "job_id"], name: "index_user_project_jobs_on_user_id_and_project_id_and_job_id", unique: true
246
+ add_index "user_project_jobs", ["user_id"], name: "index_user_project_jobs_on_user_id"
247
+
248
+ create_table "users", force: :cascade do |t|
249
+ t.string "email", default: "", null: false
250
+ t.string "encrypted_password", default: "", null: false
251
+ t.string "reset_password_token"
252
+ t.datetime "reset_password_sent_at"
253
+ t.datetime "remember_created_at"
254
+ t.integer "sign_in_count", default: 0, null: false
255
+ t.datetime "current_sign_in_at"
256
+ t.datetime "last_sign_in_at"
257
+ t.string "current_sign_in_ip"
258
+ t.string "last_sign_in_ip"
259
+ t.datetime "created_at", null: false
260
+ t.datetime "updated_at", null: false
261
+ t.integer "failed_attempts", default: 0, null: false
262
+ t.string "unlock_token"
263
+ t.datetime "locked_at"
264
+ t.string "authentication_token"
265
+ t.string "confirmation_token"
266
+ t.datetime "confirmed_at"
267
+ t.datetime "confirmation_sent_at"
268
+ t.string "unconfirmed_email"
269
+ t.string "first_name"
270
+ t.string "last_name"
271
+ end
272
+
273
+ add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true
274
+ add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
275
+ add_index "users", ["email"], name: "index_users_on_email", unique: true
276
+ add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
277
+
278
+ 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
Binary file
Binary file
@@ -0,0 +1,32 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Chat, type: :model do
4
+ let(:sender) { User.make! }
5
+ let(:target) { User.make! }
6
+ let(:target2) { User.make! }
7
+
8
+ context "a user sends a single chat" do
9
+ it "to one target and both sender and reciever can see it" do
10
+ c = sender.own_chats.build(users: [target])
11
+ c.save
12
+ c.messages.push ChatMessage.new(author: sender, message: 'Hey there. I need you at G1')
13
+ c.save!
14
+
15
+ sender.messages.size.should == 1
16
+ target.messages.size.should == 1
17
+ target2.messages.size.should == 0
18
+ end
19
+
20
+ it "to two targets and both sender and all recievers can see it" do
21
+ c = sender.own_chats.build(users: [target,target2])
22
+ c.save
23
+ c.messages.push ChatMessage.new(author: sender, message: 'Hey there. I need you at G1')
24
+ c.save!
25
+
26
+ sender.messages.size.should == 1
27
+ target.messages.size.should == 1
28
+ target2.messages.size.should == 1
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,14 @@
1
+ require 'rails_helper'
2
+ require 'paperclip/matchers'
3
+
4
+ RSpec.describe Image, type: :model do
5
+ include Paperclip::Shoulda::Matchers
6
+
7
+ it { should have_attached_file(:file) }
8
+ it { should validate_attachment_content_type(:file).
9
+ allowing('image/png', 'image/gif', 'image/jpeg')
10
+ }
11
+ it { should validate_attachment_size(:file).less_than(2.megabytes) }
12
+
13
+
14
+ end
@@ -0,0 +1,10 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Locatable, type: :model do
4
+
5
+ it "validates the locatable type" do
6
+ l = Locatable.make(locatable: User.make)
7
+ l.valid?.should == false
8
+ l.errors.messages.should == {:locatable_type=>["is not included in the list"]}
9
+ end
10
+ end
@@ -0,0 +1,17 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Project, type: :model do
4
+
5
+ it "should make a valid instance" do
6
+ Project.make.valid?.should == true
7
+ end
8
+
9
+ it "should save a valid instance" do
10
+ Project.make!.should == Project.last
11
+ end
12
+
13
+ it "should be owned by a company" do
14
+ Project.make.owner.kind_of?(Company).should == true
15
+ end
16
+
17
+ end
@@ -0,0 +1,63 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Role, type: :model do
4
+ before :all do
5
+ end
6
+ let(:user) { User.make! }
7
+ let(:company) { Company.make! }
8
+ let(:project) { Project.make! }
9
+
10
+ it "allows user assignment to super user" do
11
+ ur = Role.new(user: user, ownable: SuperUser.new )
12
+ ur.valid?.should be_truthy
13
+ end
14
+
15
+ it "allows user assignment to company admin" do
16
+ ur = Role.create(user:user, ownable: company)
17
+ ur.valid?.should be_truthy
18
+ end
19
+
20
+ it "invalidates a user role with an invalid ownable like 'Role'" do
21
+ ur = Role.create(user:user, ownable: Role.new)
22
+ ur.valid?.should be_falsey
23
+ end
24
+
25
+ context "User helper methods" do
26
+ it "should register a user as a super user" do
27
+ user.superuser?.should == false
28
+ ur = Role.create!(user:user, ownable: SuperUser.new)
29
+ user.reload
30
+ user.superuser?.should == true
31
+ end
32
+
33
+ it "should register a company admin" do
34
+ user.admin?(company).should == false
35
+ ur = Role.create!(user:user, ownable: company)
36
+ user.reload
37
+ user.admin?(company).should == true
38
+ end
39
+
40
+ it "should register a project administrator" do
41
+ user.admin?(project).should == false
42
+ ur = Role.create!(user:user, ownable: project)
43
+ user.reload
44
+ user.admin?(project).should == true
45
+ end
46
+
47
+ it "should register a user a company admin if admin of any company" do
48
+ user.company_admin?.should == false
49
+ ur = Role.create!(user:user, ownable: company)
50
+ user.reload
51
+ user.company_admin?.should == true
52
+ end
53
+
54
+ it "should register a user as a project admin if admin of any project" do
55
+ user.project_admin?.should == false
56
+ ur = Role.create!(user:user, ownable: project)
57
+ user.reload
58
+ user.project_admin?.should == true
59
+ end
60
+
61
+ end
62
+
63
+ end
@@ -0,0 +1,17 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Team, type: :model do
4
+
5
+ it "should make a valid instance" do
6
+ Team.make.valid?.should == true
7
+ end
8
+
9
+ it "should save a valid instance" do
10
+ Team.make!.should == Team.last
11
+ end
12
+
13
+ it "should be created by a user" do
14
+ Team.make.creator.kind_of?(User).should == true
15
+ end
16
+
17
+ end
@@ -0,0 +1,20 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe TeamUser, type: :model do
4
+
5
+ it "should make a valid instance" do
6
+ TeamUser.make.valid?.should == true
7
+ end
8
+
9
+ it "should save a valid instance" do
10
+ TeamUser.make!.should == TeamUser.last
11
+ end
12
+
13
+ it "should validate the user belongs to the project" do
14
+ t = TeamUser.make(team: Team.make!, user: User.make!)
15
+ t.valid?.should == false
16
+ t.errors.messages[:user].first.should =~ /is not on the \w+ project/
17
+ end
18
+
19
+
20
+ end