unsakini 0.0.3.1 → 0.0.4.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (290) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +37 -6
  3. data/angular/angular-cli.json +5 -3
  4. data/angular/npm-debug.log +54 -0
  5. data/angular/package.json +4 -1
  6. data/angular/src/app/app.component.html +1 -4
  7. data/angular/src/app/app.module.ts +8 -7
  8. data/angular/src/app/app.routes.module.ts +12 -2
  9. data/angular/src/app/confirm-account/confirm-account.component.ts +27 -0
  10. data/angular/src/app/confirm-account/confirm-account.html +41 -0
  11. data/angular/src/app/confirm-account/confirm-account.module.ts +24 -0
  12. data/angular/src/app/confirm-account/confirm-account.scss +3 -0
  13. data/angular/src/app/confirm-account/confirm-account.service.ts +27 -0
  14. data/angular/src/app/confirm-account/index.ts +3 -0
  15. data/angular/src/app/index.ts +2 -0
  16. data/angular/src/app/login/index.ts +3 -0
  17. data/angular/src/app/login/login.component.ts +40 -0
  18. data/angular/src/app/login/login.html +43 -0
  19. data/angular/src/app/login/login.module.ts +27 -0
  20. data/angular/src/app/login/login.service.ts +48 -0
  21. data/angular/src/app/registration/index.ts +3 -0
  22. data/angular/src/app/registration/registration.component.html +70 -12
  23. data/angular/src/app/registration/registration.component.spec.ts +8 -11
  24. data/angular/src/app/registration/registration.component.ts +10 -8
  25. data/angular/src/app/registration/registration.module.ts +23 -0
  26. data/angular/src/app/registration/registration.service.ts +46 -0
  27. data/angular/src/app/registration/registration.services.spec.ts +71 -0
  28. data/angular/src/app/services/auth-http/auth.http.service.ts +35 -0
  29. data/angular/src/app/services/auth-http/index.ts +1 -0
  30. data/angular/src/app/services/http/http.service.spec.ts +205 -0
  31. data/angular/src/app/services/http/http.service.ts +40 -0
  32. data/angular/src/app/services/http/index.ts +1 -0
  33. data/angular/src/app/services/index.ts +3 -0
  34. data/angular/src/app/services/services.module.ts +33 -0
  35. data/angular/src/assets/global.scss +3 -0
  36. data/angular/src/environments/custom.ts +4 -0
  37. data/angular/src/environments/environment.prod.ts +2 -1
  38. data/angular/src/environments/environment.ts +2 -1
  39. data/angular/src/index.html +1 -1
  40. data/app/controllers/application_controller.rb +2 -2
  41. data/app/controllers/concerns/unsakini/board_owner_controller_concern.rb +42 -0
  42. data/app/controllers/concerns/unsakini/comment_owner_controller_concern.rb +36 -0
  43. data/app/controllers/concerns/unsakini/logged_in_controller_concern.rb +23 -0
  44. data/app/controllers/concerns/unsakini/post_owner_controller_concern.rb +38 -0
  45. data/app/controllers/concerns/unsakini/serializer_controller_concern.rb +13 -0
  46. data/app/controllers/unsakini/base_controller.rb +6 -0
  47. data/app/controllers/unsakini/boards_controller.rb +76 -0
  48. data/app/controllers/unsakini/comments_controller.rb +54 -0
  49. data/app/controllers/unsakini/posts_controller.rb +61 -0
  50. data/app/controllers/unsakini/share_board_controller.rb +122 -0
  51. data/app/controllers/unsakini/user_token_controller.rb +17 -0
  52. data/app/controllers/unsakini/users_controller.rb +69 -0
  53. data/app/controllers/unsakini/web_controller.rb +27 -0
  54. data/app/mailers/unsakini/user_mailer.rb +13 -0
  55. data/app/models/concerns/unsakini/encryptable_model_concern.rb +97 -0
  56. data/app/models/unsakini/application_record.rb +7 -0
  57. data/app/models/unsakini/board.rb +16 -0
  58. data/app/models/unsakini/comment.rb +12 -0
  59. data/app/models/unsakini/post.rb +15 -0
  60. data/app/models/unsakini/user.rb +43 -0
  61. data/app/models/unsakini/user_board.rb +84 -0
  62. data/app/models/unsakini.rb +5 -0
  63. data/app/serializers/unsakini/board_serializer.rb +7 -0
  64. data/app/serializers/{comment_serializer.rb → unsakini/comment_serializer.rb} +6 -3
  65. data/app/serializers/unsakini/post_serializer.rb +26 -0
  66. data/app/serializers/unsakini/user_board_serializer.rb +14 -0
  67. data/app/serializers/{user_serializer.rb → unsakini/user_serializer.rb} +5 -2
  68. data/app/views/unsakini/user_mailer/confirm_account.html.erb +3 -0
  69. data/app/views/unsakini/web/index.html.erb +343 -0
  70. data/config/routes.rb +10 -10
  71. data/db/migrate/20161116114222_create_unsakini_boards.rb +10 -0
  72. data/db/migrate/{20161116200034_create_user_boards.rb → 20161116200034_create_unsakini_user_boards.rb} +3 -2
  73. data/db/migrate/{20161118031023_create_posts.rb → 20161118031023_create_unsakini_posts.rb} +2 -2
  74. data/db/migrate/{20161118100454_create_comments.rb → 20161118100454_create_unsakini_comments.rb} +2 -2
  75. data/db/migrate/20161126145352_create_unsakini_users.rb +15 -0
  76. data/lib/generators/unsakini/config/config_generator.rb +3 -1
  77. data/lib/generators/unsakini/dependencies/USAGE +5 -0
  78. data/lib/generators/unsakini/dependencies/dependencies_generator.rb +19 -0
  79. data/lib/tasks/unsakini_tasks.rake +6 -37
  80. data/lib/unsakini/engine.rb +6 -0
  81. data/lib/unsakini/version.rb +1 -1
  82. data/public/css/all.css +1204 -0
  83. data/public/css/all.css.map +7 -0
  84. data/public/css/bootstrap.css +5622 -0
  85. data/public/css/bootstrap.css.map +7 -0
  86. data/public/css/custom.css +15 -0
  87. data/public/favicons/android-chrome-144x144.png +0 -0
  88. data/public/favicons/android-chrome-192x192.png +0 -0
  89. data/public/favicons/android-chrome-36x36.png +0 -0
  90. data/public/favicons/android-chrome-48x48.png +0 -0
  91. data/public/favicons/android-chrome-72x72.png +0 -0
  92. data/public/favicons/android-chrome-96x96.png +0 -0
  93. data/public/favicons/apple-touch-icon-114x114.png +0 -0
  94. data/public/favicons/apple-touch-icon-120x120.png +0 -0
  95. data/public/favicons/apple-touch-icon-144x144.png +0 -0
  96. data/public/favicons/apple-touch-icon-152x152.png +0 -0
  97. data/public/favicons/apple-touch-icon-180x180.png +0 -0
  98. data/public/favicons/apple-touch-icon-57x57.png +0 -0
  99. data/public/favicons/apple-touch-icon-60x60.png +0 -0
  100. data/public/favicons/apple-touch-icon-72x72.png +0 -0
  101. data/public/favicons/apple-touch-icon-76x76.png +0 -0
  102. data/public/favicons/apple-touch-icon-precomposed.png +0 -0
  103. data/public/favicons/apple-touch-icon.png +0 -0
  104. data/public/favicons/favicon-16x16.png +0 -0
  105. data/public/favicons/favicon-194x194.png +0 -0
  106. data/public/favicons/favicon-32x32.png +0 -0
  107. data/public/favicons/favicon-96x96.png +0 -0
  108. data/public/favicons/favicon.ico +0 -0
  109. data/public/favicons/mstile-144x144.png +0 -0
  110. data/public/favicons/mstile-150x150.png +0 -0
  111. data/public/favicons/mstile-310x150.png +0 -0
  112. data/public/favicons/mstile-310x310.png +0 -0
  113. data/public/favicons/mstile-70x70.png +0 -0
  114. data/public/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  115. data/public/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
  116. data/public/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  117. data/public/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  118. data/public/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
  119. data/public/fonts/font-awesome-4.3.0/css/font-awesome.css +1801 -0
  120. data/public/fonts/font-awesome-4.3.0/css/font-awesome.min.css +4 -0
  121. data/public/fonts/font-awesome-4.3.0/fonts/FontAwesome.otf +0 -0
  122. data/public/fonts/font-awesome-4.3.0/fonts/fontawesome-webfont.eot +0 -0
  123. data/public/fonts/font-awesome-4.3.0/fonts/fontawesome-webfont.svg +565 -0
  124. data/public/fonts/font-awesome-4.3.0/fonts/fontawesome-webfont.ttf +0 -0
  125. data/public/fonts/font-awesome-4.3.0/fonts/fontawesome-webfont.woff +0 -0
  126. data/public/fonts/font-awesome-4.3.0/fonts/fontawesome-webfont.woff2 +0 -0
  127. data/public/images/graph-01.svg +425 -0
  128. data/public/images/graph-02.svg +435 -0
  129. data/public/images/graph-03.svg +576 -0
  130. data/public/images/graph-04.svg +70 -0
  131. data/public/images/img-01.png +0 -0
  132. data/public/images/img-decor-01.jpg +0 -0
  133. data/public/images/img-decor-02.jpg +0 -0
  134. data/public/images/img-decor-03.jpg +0 -0
  135. data/public/images/img-social-placeholder-01.png +0 -0
  136. data/public/images/logo-cb.png +0 -0
  137. data/public/images/logo-codrops.png +0 -0
  138. data/public/images/logo-pixel.png +0 -0
  139. data/public/images/logo-smashing.png +0 -0
  140. data/public/images/logo-tnw.png +0 -0
  141. data/public/images/logo-w.png +0 -0
  142. data/public/images/unsakini.svg +56 -0
  143. data/public/images/user-01.jpg +0 -0
  144. data/public/images/user-02.jpg +0 -0
  145. data/public/images/user-03.jpg +0 -0
  146. data/public/js/bootstrap.js +2306 -0
  147. data/public/js/jquery-1.11.2.min.js +4 -0
  148. data/public/js/jquery.main.js +603 -0
  149. data/public/manifest.json +41 -0
  150. data/public/unsakini/app/448c34a56d699c29117adc64c43affeb.woff2 +0 -0
  151. data/public/unsakini/app/89889688147bd7575d6327160d64e760.svg +288 -0
  152. data/public/unsakini/app/assets/global.scss +3 -0
  153. data/public/unsakini/app/e18bbf611f2a2e43afc071aa2f4e1512.ttf +0 -0
  154. data/public/unsakini/app/f4769f9bdb7466be65088239c12046d1.eot +0 -0
  155. data/public/unsakini/app/fa2772327f55d8198301fdb8bcfc8158.woff +0 -0
  156. data/{angular/dist → public/unsakini/app}/favicon.ico +0 -0
  157. data/public/unsakini/app/index.html +14 -0
  158. data/public/unsakini/app/inline.d41d8cd98f00b204e980.bundle.js +2 -0
  159. data/public/unsakini/app/inline.d41d8cd98f00b204e980.bundle.map +1 -0
  160. data/public/unsakini/app/main.54f49c65d3d20650a5d5.bundle.js +2152 -0
  161. data/public/unsakini/app/main.54f49c65d3d20650a5d5.bundle.js.gz +0 -0
  162. data/public/unsakini/app/main.54f49c65d3d20650a5d5.bundle.map +1 -0
  163. data/public/unsakini/app/styles.58e065928ed8ebd0b582.bundle.js +2 -0
  164. data/public/unsakini/app/styles.58e065928ed8ebd0b582.bundle.map +1 -0
  165. data/public/unsakini/app/styles.5dac0e986fce6f8738b300cb558b56a0.bundle.css +8 -0
  166. data/spec/concerns/models/encryptable_concern.rb +3 -2
  167. data/spec/controllers/{web_base_controller_spec.rb → web_controller_spec.rb} +5 -4
  168. data/spec/dummy/config/application.rb +3 -1
  169. data/spec/dummy/config/environments/development.rb +2 -0
  170. data/spec/dummy/config/initializers/knock.rb +59 -0
  171. data/spec/dummy/db/schema.rb +16 -14
  172. data/spec/dummy/db/test.sqlite3 +0 -0
  173. data/spec/factories/boards.rb +1 -1
  174. data/spec/factories/comments.rb +1 -1
  175. data/spec/factories/posts.rb +1 -1
  176. data/spec/factories/user_boards.rb +1 -1
  177. data/spec/factories/users.rb +1 -1
  178. data/spec/models/board_spec.rb +2 -2
  179. data/spec/models/comment_spec.rb +2 -2
  180. data/spec/models/post_spec.rb +2 -2
  181. data/spec/models/user_board_spec.rb +19 -19
  182. data/spec/models/user_spec.rb +1 -1
  183. data/spec/requests/{api/boards/api_boards_crud_spec.rb → boards/boards_crud_spec.rb} +26 -26
  184. data/spec/requests/{api/boards/api_boards_pagination_spec.rb → boards/boards_pagination_spec.rb} +7 -7
  185. data/spec/requests/{api/boards/api_private_board_spec.rb → boards/private_board_spec.rb} +26 -26
  186. data/spec/requests/{api/boards/api_shared_board_spec.rb → boards/shared_board_spec.rb} +9 -9
  187. data/spec/requests/{api/boards/api_sharing_board_spec.rb → boards/sharing_board_spec.rb} +13 -13
  188. data/spec/requests/{api/comments/api_comments_pagination_spec.rb → comments/comments_pagination_spec.rb} +3 -3
  189. data/spec/requests/{api/comments/api_comments_private_board_spec.rb → comments/comments_private_board_spec.rb} +20 -20
  190. data/spec/requests/{api/comments/api_comments_shared_board_spec.rb → comments/comments_shared_board_spec.rb} +17 -17
  191. data/spec/requests/{api/posts/api_posts_pagination_spec.rb → posts/posts_pagination_spec.rb} +3 -3
  192. data/spec/requests/{api/posts/api_posts_private_board_spec.rb → posts/posts_private_board_spec.rb} +22 -22
  193. data/spec/requests/{api/posts/api_posts_shared_board_spec.rb → posts/posts_shared_board_spec.rb} +24 -24
  194. data/spec/requests/user/user_create_spec.rb +104 -0
  195. data/spec/requests/{api/api_users_spec.rb → user/user_search_spec.rb} +9 -9
  196. data/spec/schema/jwt.json +9 -0
  197. data/spec/schema/validation_message.json +4 -0
  198. data/spec/spec_helper.rb +2 -0
  199. data/spec/support/auth_helper.rb +0 -2
  200. metadata +204 -199
  201. data/angular/dist/index.html +0 -14
  202. data/angular/dist/inline.bundle.js +0 -139
  203. data/angular/dist/inline.map +0 -1
  204. data/angular/dist/main.bundle.js +0 -64689
  205. data/angular/dist/main.map +0 -1
  206. data/angular/dist/styles.bundle.js +0 -364
  207. data/angular/dist/styles.map +0 -1
  208. data/angular/src/styles.css +0 -1
  209. data/app/controllers/api/boards_controller.rb +0 -73
  210. data/app/controllers/api/comments_controller.rb +0 -51
  211. data/app/controllers/api/posts_controller.rb +0 -58
  212. data/app/controllers/api/share_board_controller.rb +0 -118
  213. data/app/controllers/api/users_controller.rb +0 -27
  214. data/app/controllers/concerns/board_owner_controller_concern.rb +0 -38
  215. data/app/controllers/concerns/comment_owner_controller_concern.rb +0 -33
  216. data/app/controllers/concerns/logged_in_controller_concern.rb +0 -21
  217. data/app/controllers/concerns/post_owner_controller_concern.rb +0 -36
  218. data/app/controllers/concerns/serializer_controller_concern.rb +0 -11
  219. data/app/controllers/user_token_controller.rb +0 -2
  220. data/app/controllers/web_base_controller.rb +0 -15
  221. data/app/models/application_record.rb +0 -5
  222. data/app/models/board.rb +0 -14
  223. data/app/models/comment.rb +0 -9
  224. data/app/models/concerns/encryptable_model_concern.rb +0 -96
  225. data/app/models/post.rb +0 -12
  226. data/app/models/user.rb +0 -6
  227. data/app/models/user_board.rb +0 -82
  228. data/app/serializers/board_serializer.rb +0 -5
  229. data/app/serializers/post_serializer.rb +0 -23
  230. data/app/serializers/user_board_serializer.rb +0 -11
  231. data/app/views/web_base/index.html +0 -16
  232. data/db/migrate/20161116114222_create_boards.rb +0 -9
  233. data/db/migrate/20161118221508_add_encrypted_password_to_user_board.rb +0 -5
  234. data/db/migrate/20161122211105_create_users.rb +0 -12
  235. data/db/migrate/20161124102633_add_is_shared_to_boards.rb +0 -5
  236. data/lib/generators/unsakini/angular/USAGE +0 -8
  237. data/lib/generators/unsakini/angular/angular_generator.rb +0 -7
  238. data/spec/dummy/config/initializers/assets.rb +0 -11
  239. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -5
  240. data/spec/dummy/config/initializers/session_store.rb +0 -3
  241. data/spec/dummy/db/development.sqlite3 +0 -0
  242. data/spec/dummy/db/migrate/20161124210219_create_boards.unsakini_engine.rb +0 -10
  243. data/spec/dummy/db/migrate/20161124210220_create_user_boards.unsakini_engine.rb +0 -12
  244. data/spec/dummy/db/migrate/20161124210221_create_posts.unsakini_engine.rb +0 -13
  245. data/spec/dummy/db/migrate/20161124210222_create_comments.unsakini_engine.rb +0 -12
  246. data/spec/dummy/db/migrate/20161124210223_add_encrypted_password_to_user_board.unsakini_engine.rb +0 -6
  247. data/spec/dummy/db/migrate/20161124210224_create_users.unsakini_engine.rb +0 -13
  248. data/spec/dummy/db/migrate/20161124210225_add_is_shared_to_boards.unsakini_engine.rb +0 -6
  249. data/spec/dummy/public/app/favicon.ico +0 -0
  250. data/spec/dummy/public/app/index.html +0 -14
  251. data/spec/dummy/public/app/inline.bundle.js +0 -139
  252. data/spec/dummy/public/app/inline.map +0 -1
  253. data/spec/dummy/public/app/main.bundle.js +0 -64689
  254. data/spec/dummy/public/app/main.map +0 -1
  255. data/spec/dummy/public/app/styles.bundle.js +0 -364
  256. data/spec/dummy/public/app/styles.map +0 -1
  257. data/spec/dummy/tmp/unsakini-ng2/LICENSE +0 -21
  258. data/spec/dummy/tmp/unsakini-ng2/README.md +0 -1
  259. data/spec/dummy/tmp/unsakini-ng2/angular-cli.json +0 -59
  260. data/spec/dummy/tmp/unsakini-ng2/e2e/app.e2e-spec.ts +0 -14
  261. data/spec/dummy/tmp/unsakini-ng2/e2e/app.po.ts +0 -11
  262. data/spec/dummy/tmp/unsakini-ng2/e2e/signup.e2e-spec.ts +0 -28
  263. data/spec/dummy/tmp/unsakini-ng2/e2e/signup.po.ts +0 -31
  264. data/spec/dummy/tmp/unsakini-ng2/e2e/tsconfig.json +0 -16
  265. data/spec/dummy/tmp/unsakini-ng2/karma.conf.js +0 -45
  266. data/spec/dummy/tmp/unsakini-ng2/package.json +0 -49
  267. data/spec/dummy/tmp/unsakini-ng2/protractor.conf.js +0 -32
  268. data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.css +0 -0
  269. data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.html +0 -4
  270. data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.spec.ts +0 -47
  271. data/spec/dummy/tmp/unsakini-ng2/src/app/app.component.ts +0 -10
  272. data/spec/dummy/tmp/unsakini-ng2/src/app/app.module.ts +0 -29
  273. data/spec/dummy/tmp/unsakini-ng2/src/app/app.routes.module.ts +0 -29
  274. data/spec/dummy/tmp/unsakini-ng2/src/app/index.ts +0 -2
  275. data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.css +0 -0
  276. data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.html +0 -14
  277. data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.spec.ts +0 -157
  278. data/spec/dummy/tmp/unsakini-ng2/src/app/registration/registration.component.ts +0 -42
  279. data/spec/dummy/tmp/unsakini-ng2/src/environments/environment.prod.ts +0 -3
  280. data/spec/dummy/tmp/unsakini-ng2/src/environments/environment.ts +0 -8
  281. data/spec/dummy/tmp/unsakini-ng2/src/favicon.ico +0 -0
  282. data/spec/dummy/tmp/unsakini-ng2/src/index.html +0 -14
  283. data/spec/dummy/tmp/unsakini-ng2/src/main.ts +0 -12
  284. data/spec/dummy/tmp/unsakini-ng2/src/polyfills.ts +0 -19
  285. data/spec/dummy/tmp/unsakini-ng2/src/styles.css +0 -1
  286. data/spec/dummy/tmp/unsakini-ng2/src/test.ts +0 -31
  287. data/spec/dummy/tmp/unsakini-ng2/src/tsconfig.json +0 -18
  288. data/spec/dummy/tmp/unsakini-ng2/src/typings.d.ts +0 -2
  289. data/spec/dummy/tmp/unsakini-ng2/tslint.json +0 -114
  290. data/spec/dummy/tmp/unsakini-ng2/typings.json +0 -4
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- RSpec.describe "Api::Board::Post::Comments", type: :request do
3
+ RSpec.describe "Unsakini::Board::Post::Comments", type: :request do
4
4
 
5
5
  before(:all) do
6
6
  user_has_shared_board_with_posts_scenario
@@ -19,12 +19,12 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
19
19
  context "Comments on my post" do
20
20
 
21
21
  it "returns http unauthorized" do
22
- get api_board_post_comments_path(@board, @post)
22
+ get unsakini_board_post_comments_path(@board, @post)
23
23
  expect(response).to have_http_status(:unauthorized)
24
24
  end
25
25
 
26
26
  it "returns http unauthorized" do
27
- put api_board_post_comment_path(@board, @post, @comment), params: valid_attributes, as: :json
27
+ put unsakini_board_post_comment_path(@board, @post, @comment), params: valid_attributes, as: :json
28
28
  expect(response).to have_http_status(:unauthorized)
29
29
  end
30
30
 
@@ -32,7 +32,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
32
32
  describe "Get all comments on my post" do
33
33
  describe "As a post owner" do
34
34
  it "returns all comments" do
35
- get api_board_post_comments_path(@board, @post), headers: auth_headers(@user)
35
+ get unsakini_board_post_comments_path(@board, @post), headers: auth_headers(@user)
36
36
  expect(response).to have_http_status(:ok)
37
37
  expect(body_to_json('0')).to match_json_schema(:comment)
38
38
  expect(body_to_json.count).to eq @post.comments.count
@@ -41,12 +41,12 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
41
41
 
42
42
  describe "As another user" do
43
43
  it "returns http forbidden" do
44
- get api_board_post_comments_path(@board, @post), headers: auth_headers(@user_2)
44
+ get unsakini_board_post_comments_path(@board, @post), headers: auth_headers(@user_2)
45
45
  expect(response).to have_http_status(:forbidden)
46
46
  end
47
47
 
48
48
  it "returns http forbidden" do
49
- get api_board_post_comments_path(@shared_board, @post), headers: auth_headers(@user_2)
49
+ get unsakini_board_post_comments_path(@shared_board, @post), headers: auth_headers(@user_2)
50
50
  expect(response).to have_http_status(:forbidden)
51
51
  end
52
52
  end
@@ -58,13 +58,13 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
58
58
  describe "As post owner" do
59
59
 
60
60
  it "returns http unauthorized" do
61
- post api_board_post_comments_path(@board, @post), as: :json, params: valid_attributes
61
+ post unsakini_board_post_comments_path(@board, @post), as: :json, params: valid_attributes
62
62
  expect(response).to have_http_status(:unauthorized)
63
63
  end
64
64
 
65
65
  it "returns http unprocessable_entity" do
66
66
  post(
67
- api_board_post_comments_path(@board, @post),
67
+ unsakini_board_post_comments_path(@board, @post),
68
68
  headers: auth_headers(@user),
69
69
  params: invalid_attributes,
70
70
  as: :json
@@ -76,7 +76,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
76
76
  it "creates a new comment" do
77
77
  comment_count = @post.comments.count
78
78
  post(
79
- api_board_post_comments_path(@board, @post),
79
+ unsakini_board_post_comments_path(@board, @post),
80
80
  headers: auth_headers(@user),
81
81
  params: valid_attributes,
82
82
  as: :json
@@ -85,7 +85,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
85
85
  expect(response.body).to match_json_schema(:comment)
86
86
  expect(body_to_json('id')).to eq @post.comments.last.id
87
87
  expect(body_to_json('user/id')).to eq @user.id
88
- expect(Comment.find_by_id(body_to_json('id'))).to eq @post.comments.last
88
+ expect(Unsakini::Comment.find_by_id(body_to_json('id'))).to eq @post.comments.last
89
89
  expect(@post.comments.count).to eq(comment_count+1)
90
90
  end
91
91
  end
@@ -93,13 +93,13 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
93
93
  describe "As another user" do
94
94
 
95
95
  it "returns http unauthorized" do
96
- post api_board_post_comments_path(@board, @post), as: :json, params: valid_attributes
96
+ post unsakini_board_post_comments_path(@board, @post), as: :json, params: valid_attributes
97
97
  expect(response).to have_http_status(:unauthorized)
98
98
  end
99
99
 
100
100
  it "returns http forbidden" do
101
101
  post(
102
- api_board_post_comments_path(@board, @post),
102
+ unsakini_board_post_comments_path(@board, @post),
103
103
  headers: auth_headers(@user_2),
104
104
  params: valid_attributes,
105
105
  as: :json
@@ -117,7 +117,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
117
117
 
118
118
  it "updates my comment if user is me" do
119
119
  put(
120
- api_board_post_comment_path(@board, @post, @comment),
120
+ unsakini_board_post_comment_path(@board, @post, @comment),
121
121
  params: valid_attributes,
122
122
  headers: auth_headers(@user),
123
123
  as: :json
@@ -133,7 +133,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
133
133
 
134
134
  it "returns http forbidden if not comment owner" do
135
135
  put(
136
- api_board_post_comment_path(@board, @post, @comment),
136
+ unsakini_board_post_comment_path(@board, @post, @comment),
137
137
  params: valid_attributes,
138
138
  headers: auth_headers(@user_2),
139
139
  as: :json
@@ -152,12 +152,12 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
152
152
  it "Deletes my comment if user is me" do
153
153
  prev_comment_count = @post.comments.count
154
154
  delete(
155
- api_board_post_comment_path(@board, @post, @comment),
155
+ unsakini_board_post_comment_path(@board, @post, @comment),
156
156
  headers: auth_headers(@user),
157
157
  )
158
158
  expect(response).to have_http_status(:ok)
159
159
  expect(@post.comments.count).to eq(prev_comment_count-1)
160
- expect(Comment.find_by_id(@comment.id)).to be_nil
160
+ expect(Unsakini::Comment.find_by_id(@comment.id)).to be_nil
161
161
  end
162
162
 
163
163
  end
@@ -167,23 +167,23 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
167
167
  it "returns http forbidden if not comment owner" do
168
168
  prev_comment_count = @post.comments.count
169
169
  delete(
170
- api_board_post_comment_path(@board, @post, @comment),
170
+ unsakini_board_post_comment_path(@board, @post, @comment),
171
171
  headers: auth_headers(@user_2),
172
172
  )
173
173
  expect(response).to have_http_status(:forbidden)
174
174
  expect(@post.comments.count).to eq(prev_comment_count)
175
- expect(Comment.find_by_id(@comment.id)).not_to be_nil
175
+ expect(Unsakini::Comment.find_by_id(@comment.id)).not_to be_nil
176
176
  end
177
177
 
178
178
  it "Deletes my comment if user is me" do
179
179
  prev_comment_count = @post.comments.count
180
180
  delete(
181
- api_board_post_comment_path(@board, @post, @comment),
181
+ unsakini_board_post_comment_path(@board, @post, @comment),
182
182
  headers: auth_headers(@user),
183
183
  )
184
184
  expect(response).to have_http_status(:ok)
185
185
  expect(@post.comments.count).to eq(prev_comment_count-1)
186
- expect(Comment.find_by_id(@comment.id)).to be_nil
186
+ expect(Unsakini::Comment.find_by_id(@comment.id)).to be_nil
187
187
  end
188
188
 
189
189
  end
@@ -1,6 +1,6 @@
1
1
  require 'rails_helper'
2
2
 
3
- RSpec.describe "Api::Board::Post::Comments", type: :request do
3
+ RSpec.describe "Unsakini::Board::Post::Comments", type: :request do
4
4
 
5
5
  before(:all) do
6
6
  user_has_shared_board_with_posts_scenario
@@ -23,7 +23,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
23
23
  describe "As a post owner" do
24
24
 
25
25
  it "returns all comments" do
26
- get api_board_post_comments_path(@shared_board, @shared_post), headers: auth_headers(@user)
26
+ get unsakini_board_post_comments_path(@shared_board, @shared_post), headers: auth_headers(@user)
27
27
  expect(response).to have_http_status(:ok)
28
28
  expect(body_to_json('0')).to match_json_schema(:comment)
29
29
  expect(body_to_json.count).to eq @shared_post.comments.count
@@ -33,7 +33,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
33
33
 
34
34
  describe "As another user" do
35
35
  it "returns all comments" do
36
- get api_board_post_comments_path(@shared_board, @shared_post), headers: auth_headers(@user_2)
36
+ get unsakini_board_post_comments_path(@shared_board, @shared_post), headers: auth_headers(@user_2)
37
37
  expect(response).to have_http_status(:ok)
38
38
  expect(body_to_json('0')).to match_json_schema(:comment)
39
39
  expect(body_to_json.count).to eq @shared_post.comments.count
@@ -48,7 +48,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
48
48
 
49
49
  it "returns http unprocessable_entity" do
50
50
  post(
51
- api_board_post_comments_path(@shared_board, @shared_post),
51
+ unsakini_board_post_comments_path(@shared_board, @shared_post),
52
52
  headers: auth_headers(@user),
53
53
  params: invalid_attributes,
54
54
  as: :json
@@ -60,7 +60,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
60
60
  it "creates a new comment" do
61
61
  comment_count = @shared_post.comments.count
62
62
  post(
63
- api_board_post_comments_path(@shared_board, @shared_post),
63
+ unsakini_board_post_comments_path(@shared_board, @shared_post),
64
64
  headers: auth_headers(@user),
65
65
  params: valid_attributes,
66
66
  as: :json
@@ -69,7 +69,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
69
69
  expect(response.body).to match_json_schema(:comment)
70
70
  expect(body_to_json('content')).to eq valid_attributes[:content]
71
71
  expect(body_to_json('user/id')).to eq @user.id
72
- expect(Comment.find_by_id(body_to_json('id'))).to eq @shared_post.comments.last
72
+ expect(Unsakini::Comment.find_by_id(body_to_json('id'))).to eq @shared_post.comments.last
73
73
  expect(@shared_post.comments.count).to eq(comment_count+1)
74
74
  end
75
75
 
@@ -79,7 +79,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
79
79
 
80
80
  it "returns http unprocessable_entity" do
81
81
  post(
82
- api_board_post_comments_path(@shared_board, @shared_post),
82
+ unsakini_board_post_comments_path(@shared_board, @shared_post),
83
83
  headers: auth_headers(@user_2),
84
84
  params: invalid_attributes,
85
85
  as: :json
@@ -91,7 +91,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
91
91
  it "creates a new comment" do
92
92
  comment_count = @shared_post.comments.count
93
93
  post(
94
- api_board_post_comments_path(@shared_board, @shared_post),
94
+ unsakini_board_post_comments_path(@shared_board, @shared_post),
95
95
  headers: auth_headers(@user_2),
96
96
  params: valid_attributes,
97
97
  as: :json
@@ -100,7 +100,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
100
100
  expect(response.body).to match_json_schema(:comment)
101
101
  expect(body_to_json('content')).to eq valid_attributes[:content]
102
102
  expect(body_to_json('user/id')).to eq @user_2.id
103
- expect(Comment.find_by_id(body_to_json('id'))).to eq @shared_post.comments.last
103
+ expect(Unsakini::Comment.find_by_id(body_to_json('id'))).to eq @shared_post.comments.last
104
104
  expect(@shared_post.comments.count).to eq(comment_count+1)
105
105
  end
106
106
 
@@ -113,7 +113,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
113
113
  context "As comment owner" do
114
114
  it "updates my comment if user is me" do
115
115
  put(
116
- api_board_post_comment_path(@shared_board, @shared_post, @shared_comment),
116
+ unsakini_board_post_comment_path(@shared_board, @shared_post, @shared_comment),
117
117
  params: valid_attributes,
118
118
  headers: auth_headers(@user),
119
119
  as: :json
@@ -128,7 +128,7 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
128
128
 
129
129
  it "returns http forbidden if not comment owner" do
130
130
  put(
131
- api_board_post_comment_path(@shared_board, @shared_post, @shared_comment),
131
+ unsakini_board_post_comment_path(@shared_board, @shared_post, @shared_comment),
132
132
  params: valid_attributes,
133
133
  headers: auth_headers(@user_2),
134
134
  as: :json
@@ -145,12 +145,12 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
145
145
  it "Deletes my comment if user is me" do
146
146
  prev_comment_count = @shared_post.comments.count
147
147
  delete(
148
- api_board_post_comment_path(@shared_board, @shared_post, @shared_comment),
148
+ unsakini_board_post_comment_path(@shared_board, @shared_post, @shared_comment),
149
149
  headers: auth_headers(@user),
150
150
  )
151
151
  expect(response).to have_http_status(:ok)
152
152
  expect(@shared_post.comments.count).to eq(prev_comment_count-1)
153
- expect(Comment.find_by_id(@shared_comment.id)).to be_nil
153
+ expect(Unsakini::Comment.find_by_id(@shared_comment.id)).to be_nil
154
154
  end
155
155
 
156
156
  end
@@ -160,23 +160,23 @@ RSpec.describe "Api::Board::Post::Comments", type: :request do
160
160
  it "returns http forbidden if not comment owner" do
161
161
  prev_comment_count = @shared_post.comments.count
162
162
  delete(
163
- api_board_post_comment_path(@shared_board, @shared_post, @shared_comment),
163
+ unsakini_board_post_comment_path(@shared_board, @shared_post, @shared_comment),
164
164
  headers: auth_headers(@user_2),
165
165
  )
166
166
  expect(response).to have_http_status(:forbidden)
167
167
  expect(@shared_post.comments.count).to eq(prev_comment_count)
168
- expect(Comment.find_by_id(@shared_comment.id)).not_to be_nil
168
+ expect(Unsakini::Comment.find_by_id(@shared_comment.id)).not_to be_nil
169
169
  end
170
170
 
171
171
  it "Deletes my comment if user is me" do
172
172
  prev_comment_count = @shared_post.comments.count
173
173
  delete(
174
- api_board_post_comment_path(@shared_board, @shared_post, @shared_comment),
174
+ unsakini_board_post_comment_path(@shared_board, @shared_post, @shared_comment),
175
175
  headers: auth_headers(@user),
176
176
  )
177
177
  expect(response).to have_http_status(:ok)
178
178
  expect(@shared_post.comments.count).to eq(prev_comment_count-1)
179
- expect(Comment.find_by_id(@shared_comment.id)).to be_nil
179
+ expect(Unsakini::Comment.find_by_id(@shared_comment.id)).to be_nil
180
180
  end
181
181
 
182
182
  end
@@ -1,7 +1,7 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  # test scope is @user is owner of the board and owner of the post/s
4
- RSpec.describe "Api::Board::Posts", type: :request do
4
+ RSpec.describe "Usakini::Board::Posts", type: :request do
5
5
 
6
6
  before(:each) do
7
7
  user_has_many_posts_scenario
@@ -14,7 +14,7 @@ RSpec.describe "Api::Board::Posts", type: :request do
14
14
  describe "Get Posts" do
15
15
 
16
16
  it "return posts" do
17
- get api_board_posts_path(@board), headers: auth_headers(@user), params: {page: 1}
17
+ get unsakini_board_posts_path(@board), headers: auth_headers(@user), params: {page: 1}
18
18
  expect(response).to have_http_status(:ok)
19
19
  expect(body_to_json.count).to eq num_per_page
20
20
  expect(body_to_json('0')).to match_json_schema(:post)
@@ -22,7 +22,7 @@ RSpec.describe "Api::Board::Posts", type: :request do
22
22
  end
23
23
 
24
24
  it "return last page" do
25
- get api_board_posts_path(@board), headers: auth_headers(@user), params: {page: 2}
25
+ get unsakini_board_posts_path(@board), headers: auth_headers(@user), params: {page: 2}
26
26
  expect(response).to have_http_status(:ok)
27
27
  expect(body_to_json.count).to eq @num_posts - num_per_page
28
28
  expect(body_to_json('0')).to match_json_schema(:post)
@@ -1,7 +1,7 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  # test scope is @user is owner of the board and owner of the post/s
4
- RSpec.describe "Api::Board::Posts", type: :request do
4
+ RSpec.describe "Unsakini::Board::Posts", type: :request do
5
5
 
6
6
  before(:each) do
7
7
  user_has_shared_board_scenario
@@ -22,15 +22,15 @@ RSpec.describe "Api::Board::Posts", type: :request do
22
22
  describe "Get All Posts" do
23
23
 
24
24
  it "return http unauthorized" do
25
- get api_board_posts_path(@board)
25
+ get unsakini_board_posts_path(@board)
26
26
  expect(response).to have_http_status(:unauthorized)
27
27
  end
28
28
  it "return http forbidden" do
29
- get api_board_posts_path(@board), headers: auth_headers(@user_2)
29
+ get unsakini_board_posts_path(@board), headers: auth_headers(@user_2)
30
30
  expect(response).to have_http_status(:forbidden)
31
31
  end
32
32
  it "return post" do
33
- get api_board_posts_path(@board), headers: auth_headers(@user)
33
+ get unsakini_board_posts_path(@board), headers: auth_headers(@user)
34
34
  expect(response).to have_http_status(:ok)
35
35
  expect(body_to_json('0')).to match_json_schema(:post)
36
36
  expect(response.body).to be_json_eql(serialize(@board.posts.all))
@@ -39,15 +39,15 @@ RSpec.describe "Api::Board::Posts", type: :request do
39
39
 
40
40
  describe "Get Single Post" do
41
41
  it "return http unauthorized" do
42
- get api_board_post_path(@board, @post)
42
+ get unsakini_board_post_path(@board, @post)
43
43
  expect(response).to have_http_status(:unauthorized)
44
44
  end
45
45
  it "return http forbidden" do
46
- get api_board_post_path(@board, @post), headers: auth_headers(@user_2)
46
+ get unsakini_board_post_path(@board, @post), headers: auth_headers(@user_2)
47
47
  expect(response).to have_http_status(:forbidden)
48
48
  end
49
49
  it "return post" do
50
- get api_board_post_path(@board, @post), headers: auth_headers(@user)
50
+ get unsakini_board_post_path(@board, @post), headers: auth_headers(@user)
51
51
  expect(response).to have_http_status(:ok)
52
52
  expect(response.body).to match_json_schema(:post)
53
53
  expect(response.body).to be_json_eql(serialize(@post))
@@ -56,26 +56,26 @@ RSpec.describe "Api::Board::Posts", type: :request do
56
56
 
57
57
  describe "Create Post" do
58
58
  it "return http unauthorized" do
59
- post api_board_posts_path(@board), as: :json
59
+ post unsakini_board_posts_path(@board), as: :json
60
60
  expect(response).to have_http_status(:unauthorized)
61
61
  end
62
62
  it "return http forbidden when not owner" do
63
- post api_board_posts_path(@board), headers: auth_headers(@user_2), params: valid_attributes, as: :json
63
+ post unsakini_board_posts_path(@board), headers: auth_headers(@user_2), params: valid_attributes, as: :json
64
64
  expect(response).to have_http_status(:forbidden)
65
65
  end
66
66
  it "return http unprocessable_entity when invalid title" do
67
- post api_board_posts_path(@board), headers: auth_headers(@user), params: invalid_title_attribute, as: :json
67
+ post unsakini_board_posts_path(@board), headers: auth_headers(@user), params: invalid_title_attribute, as: :json
68
68
  expect(response).to have_http_status(:unprocessable_entity)
69
69
  # todo: assert errors
70
70
  end
71
71
  it "return http unprocessable_entity when invalid content" do
72
- post api_board_posts_path(@board), headers: auth_headers(@user), params: invalid_content_attribute, as: :json
72
+ post unsakini_board_posts_path(@board), headers: auth_headers(@user), params: invalid_content_attribute, as: :json
73
73
  expect(response).to have_http_status(:unprocessable_entity)
74
74
  # todo: assert errors
75
75
  end
76
76
  it "successfully creates a post" do
77
77
  board_posts_count = @board.posts.count
78
- post api_board_posts_path(@board), headers: auth_headers(@user), params: valid_attributes, as: :json
78
+ post unsakini_board_posts_path(@board), headers: auth_headers(@user), params: valid_attributes, as: :json
79
79
  expect(response).to have_http_status(:created)
80
80
  expect(response.body).to match_json_schema(:post)
81
81
  expect(response.body).to be_json_eql(serialize(@board.posts.last))
@@ -86,25 +86,25 @@ RSpec.describe "Api::Board::Posts", type: :request do
86
86
  describe "Update Post" do
87
87
 
88
88
  it "return http unauthorized" do
89
- put api_board_post_path(@board, @post), as: :json
89
+ put unsakini_board_post_path(@board, @post), as: :json
90
90
  expect(response).to have_http_status(:unauthorized)
91
91
  end
92
92
  it "return http forbidden when not owner" do
93
- put api_board_post_path(@board, @post), headers: auth_headers(@user_2), params: valid_attributes, as: :json
93
+ put unsakini_board_post_path(@board, @post), headers: auth_headers(@user_2), params: valid_attributes, as: :json
94
94
  expect(response).to have_http_status(:forbidden)
95
95
  end
96
96
  it "return http unprocessable_entity when invalid title" do
97
- put api_board_post_path(@board, @post), headers: auth_headers(@user), params: invalid_title_attribute, as: :json
97
+ put unsakini_board_post_path(@board, @post), headers: auth_headers(@user), params: invalid_title_attribute, as: :json
98
98
  expect(response).to have_http_status(:unprocessable_entity)
99
99
  # todo: assert errors
100
100
  end
101
101
  it "return http unprocessable_entity when invalid content" do
102
- put api_board_post_path(@board, @post), headers: auth_headers(@user), params: invalid_content_attribute, as: :json
102
+ put unsakini_board_post_path(@board, @post), headers: auth_headers(@user), params: invalid_content_attribute, as: :json
103
103
  expect(response).to have_http_status(:unprocessable_entity)
104
104
  # todo: assert errors
105
105
  end
106
106
  it "updates my post belonging to my board" do
107
- put api_board_post_path(@board, @post), headers: auth_headers(@user), params: valid_attributes, as: :json
107
+ put unsakini_board_post_path(@board, @post), headers: auth_headers(@user), params: valid_attributes, as: :json
108
108
  expect(response).to have_http_status(:ok)
109
109
  expect(response.body).to match_json_schema(:post)
110
110
  expect(body_to_json('title')).to eq(valid_attributes[:title])
@@ -114,21 +114,21 @@ RSpec.describe "Api::Board::Posts", type: :request do
114
114
 
115
115
  describe "Delete Post" do
116
116
  it "return http unauthorized" do
117
- delete api_board_post_path(@board, @post)
117
+ delete unsakini_board_post_path(@board, @post)
118
118
  expect(response).to have_http_status(:unauthorized)
119
119
  end
120
120
  it "return http forbidden if not owner" do
121
- delete api_board_post_path(@board, @post), headers: auth_headers(@user_2)
121
+ delete unsakini_board_post_path(@board, @post), headers: auth_headers(@user_2)
122
122
  expect(response).to have_http_status(:forbidden)
123
123
  end
124
124
  it "removes my post" do
125
125
  post_id = @post.id
126
126
  board_posts_count = @board.posts.count
127
- delete api_board_post_path(@board, @post), headers: auth_headers(@user)
127
+ delete unsakini_board_post_path(@board, @post), headers: auth_headers(@user)
128
128
  expect(response).to have_http_status(:ok)
129
129
  expect(@board.posts.count).to eq(board_posts_count-1)
130
- expect(Post.find_by_id(post_id)).to be_nil
131
- expect(Comment.where(post_id: post_id)).to be_empty
130
+ expect(Unsakini::Post.find_by_id(post_id)).to be_nil
131
+ expect(Unsakini::Comment.where(post_id: post_id)).to be_empty
132
132
  end
133
133
  end
134
134
  end
@@ -1,7 +1,7 @@
1
1
  require 'rails_helper'
2
2
 
3
3
  # test scope is @user is owner of the board and owner of the post/s
4
- RSpec.describe "Api::Board::Posts", type: :request do
4
+ RSpec.describe "Unsakini::Board::Posts", type: :request do
5
5
 
6
6
  before(:each) do
7
7
  user_has_shared_board_scenario
@@ -21,17 +21,17 @@ RSpec.describe "Api::Board::Posts", type: :request do
21
21
 
22
22
  describe "Get all posts" do
23
23
  it "return http unauthorized" do
24
- get api_board_posts_path(@shared_board)
24
+ get unsakini_board_posts_path(@shared_board)
25
25
  expect(response).to have_http_status(:unauthorized)
26
26
  end
27
27
  it "returns all posts for first user" do
28
- get api_board_posts_path(@shared_board), headers: auth_headers(@user)
28
+ get unsakini_board_posts_path(@shared_board), headers: auth_headers(@user)
29
29
  expect(response).to have_http_status(:ok)
30
30
  expect(body_to_json('0')).to match_json_schema(:post)
31
31
  expect(response.body).to be_json_eql(serialize(@shared_board.posts.all))
32
32
  end
33
33
  it "returns all posts for second user" do
34
- get api_board_posts_path(@shared_board), headers: auth_headers(@user_2)
34
+ get unsakini_board_posts_path(@shared_board), headers: auth_headers(@user_2)
35
35
  expect(response).to have_http_status(:ok)
36
36
  expect(body_to_json('0')).to match_json_schema(:post)
37
37
  expect(response.body).to be_json_eql(serialize(@shared_board.posts.all))
@@ -40,17 +40,17 @@ RSpec.describe "Api::Board::Posts", type: :request do
40
40
 
41
41
  describe "Get single post" do
42
42
  it "return http unauthorized" do
43
- get api_board_post_path(@shared_board, @shared_post)
43
+ get unsakini_board_post_path(@shared_board, @shared_post)
44
44
  expect(response).to have_http_status(:unauthorized)
45
45
  end
46
46
  it "renders post resource to first user" do
47
- get api_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user)
47
+ get unsakini_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user)
48
48
  expect(response).to have_http_status(:ok)
49
49
  expect(response.body).to match_json_schema(:post)
50
50
  expect(response.body).to be_json_eql(serialize(@shared_post))
51
51
  end
52
52
  it "renders post resource to 2nd user" do
53
- get api_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user_2)
53
+ get unsakini_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user_2)
54
54
  expect(response).to have_http_status(:ok)
55
55
  expect(response.body).to match_json_schema(:post)
56
56
  expect(response.body).to be_json_eql(serialize(@shared_post))
@@ -61,24 +61,24 @@ RSpec.describe "Api::Board::Posts", type: :request do
61
61
  describe "Create post" do
62
62
 
63
63
  it "return http unauthorized" do
64
- post api_board_posts_path(@shared_board), as: :json
64
+ post unsakini_board_posts_path(@shared_board), as: :json
65
65
  expect(response).to have_http_status(:unauthorized)
66
66
  end
67
67
 
68
68
  context "Board owner" do
69
69
  it "return http unprocessable_entity when invalid title" do
70
- post api_board_posts_path(@shared_board), headers: auth_headers(@user), params: invalid_title_attribute, as: :json
70
+ post unsakini_board_posts_path(@shared_board), headers: auth_headers(@user), params: invalid_title_attribute, as: :json
71
71
  expect(response).to have_http_status(:unprocessable_entity)
72
72
  # todo: assert errors
73
73
  end
74
74
  it "return http unprocessable_entity when invalid content" do
75
- post api_board_posts_path(@shared_board), headers: auth_headers(@user), params: invalid_content_attribute, as: :json
75
+ post unsakini_board_posts_path(@shared_board), headers: auth_headers(@user), params: invalid_content_attribute, as: :json
76
76
  expect(response).to have_http_status(:unprocessable_entity)
77
77
  # todo: assert errors
78
78
  end
79
79
  it "successfully creates a post" do
80
80
  board_posts_count = @shared_board.posts.count
81
- post api_board_posts_path(@shared_board), headers: auth_headers(@user), params: valid_attributes, as: :json
81
+ post unsakini_board_posts_path(@shared_board), headers: auth_headers(@user), params: valid_attributes, as: :json
82
82
  expect(response).to have_http_status(:created)
83
83
  expect(response.body).to match_json_schema(:post)
84
84
  expect(response.body).to be_json_eql(serialize(@shared_board.posts.last))
@@ -88,18 +88,18 @@ RSpec.describe "Api::Board::Posts", type: :request do
88
88
 
89
89
  context "Board shared user" do
90
90
  it "return http unprocessable_entity when invalid title" do
91
- post api_board_posts_path(@shared_board), headers: auth_headers(@user_2), params: invalid_title_attribute, as: :json
91
+ post unsakini_board_posts_path(@shared_board), headers: auth_headers(@user_2), params: invalid_title_attribute, as: :json
92
92
  expect(response).to have_http_status(:unprocessable_entity)
93
93
  # todo: assert errors
94
94
  end
95
95
  it "return http unprocessable_entity when invalid content" do
96
- post api_board_posts_path(@shared_board), headers: auth_headers(@user_2), params: invalid_content_attribute, as: :json
96
+ post unsakini_board_posts_path(@shared_board), headers: auth_headers(@user_2), params: invalid_content_attribute, as: :json
97
97
  expect(response).to have_http_status(:unprocessable_entity)
98
98
  # todo: assert errors
99
99
  end
100
100
  it "successfully creates a post" do
101
101
  board_posts_count = @shared_board.posts.count
102
- post api_board_posts_path(@shared_board), headers: auth_headers(@user_2), params: valid_attributes, as: :json
102
+ post unsakini_board_posts_path(@shared_board), headers: auth_headers(@user_2), params: valid_attributes, as: :json
103
103
  expect(response).to have_http_status(:created)
104
104
  expect(response.body).to match_json_schema(:post)
105
105
  expect(response.body).to be_json_eql(serialize(@shared_board.posts.last))
@@ -113,23 +113,23 @@ RSpec.describe "Api::Board::Posts", type: :request do
113
113
 
114
114
  # owner of the post in the board should be able to update it
115
115
  it "return http unauthorized" do
116
- put api_board_post_path(@shared_board, @shared_post), as: :json
116
+ put unsakini_board_post_path(@shared_board, @shared_post), as: :json
117
117
  expect(response).to have_http_status(:unauthorized)
118
118
  end
119
119
 
120
120
  context "Post owner" do
121
121
  it "return http unprocessable_entity when invalid title" do
122
- put api_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user), params: invalid_title_attribute, as: :json
122
+ put unsakini_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user), params: invalid_title_attribute, as: :json
123
123
  expect(response).to have_http_status(:unprocessable_entity)
124
124
  # todo: assert errors
125
125
  end
126
126
  it "return http unprocessable_entity when invalid content" do
127
- put api_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user), params: invalid_content_attribute, as: :json
127
+ put unsakini_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user), params: invalid_content_attribute, as: :json
128
128
  expect(response).to have_http_status(:unprocessable_entity)
129
129
  # todo: assert errors
130
130
  end
131
131
  it "updates my post belonging to my board" do
132
- put api_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user), params: valid_attributes, as: :json
132
+ put unsakini_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user), params: valid_attributes, as: :json
133
133
  expect(response).to have_http_status(:ok)
134
134
  expect(response.body).to match_json_schema(:post)
135
135
  @shared_post.reload
@@ -142,7 +142,7 @@ RSpec.describe "Api::Board::Posts", type: :request do
142
142
  # while the shared user should not
143
143
  context "Shared user" do
144
144
  it "cannot update the post" do
145
- put api_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user_2), params: valid_attributes, as: :json
145
+ put unsakini_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user_2), params: valid_attributes, as: :json
146
146
  expect(response).to have_http_status(:forbidden)
147
147
  @shared_post.reload
148
148
  expect(@shared_post.title).to_not eq(valid_attributes[:title])
@@ -154,27 +154,27 @@ RSpec.describe "Api::Board::Posts", type: :request do
154
154
  describe "Delete my post" do
155
155
 
156
156
  it "return http unauthorized" do
157
- delete api_board_post_path(@shared_board, @shared_post)
157
+ delete unsakini_board_post_path(@shared_board, @shared_post)
158
158
  expect(response).to have_http_status(:unauthorized)
159
159
  end
160
160
 
161
161
  describe "Post owner" do
162
162
  it "deletes own post" do
163
163
  board_posts_count = @shared_board.posts.count
164
- delete api_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user)
164
+ delete unsakini_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user)
165
165
  expect(response).to have_http_status(:ok)
166
166
  expect(@shared_board.posts.count).to eq(board_posts_count-1)
167
- expect(Post.find_by_id(@shared_post.id)).to be_nil
167
+ expect(Unsakini::Post.find_by_id(@shared_post.id)).to be_nil
168
168
  end
169
169
  end
170
170
 
171
171
  describe "Shared user" do
172
172
  it "return http forbidden" do
173
173
  board_posts_count = @shared_board.posts.count
174
- delete api_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user_2)
174
+ delete unsakini_board_post_path(@shared_board, @shared_post), headers: auth_headers(@user_2)
175
175
  expect(response).to have_http_status(:forbidden)
176
176
  expect(board_posts_count).to eq(@shared_board.posts.count)
177
- expect(Post.find_by_id(@shared_post.id)).not_to be_nil
177
+ expect(Unsakini::Post.find_by_id(@shared_post.id)).not_to be_nil
178
178
  end
179
179
  end
180
180