amazon-chime-sdk-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +87 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +47 -0
  5. data/.yardopts +6 -0
  6. data/CHANGELOG.md +3 -0
  7. data/Gemfile +25 -0
  8. data/LICENSE +21 -0
  9. data/README.md +1109 -0
  10. data/Rakefile +20 -0
  11. data/amazon-chime-sdk-rails.gemspec +29 -0
  12. data/gemfiles/Gemfile.rails-5.0 +25 -0
  13. data/gemfiles/Gemfile.rails-5.1 +25 -0
  14. data/gemfiles/Gemfile.rails-5.2 +25 -0
  15. data/gemfiles/Gemfile.rails-6.0 +25 -0
  16. data/lib/amazon-chime-sdk-rails.rb +37 -0
  17. data/lib/chime_sdk/config.rb +90 -0
  18. data/lib/chime_sdk/controller/attendees.rb +128 -0
  19. data/lib/chime_sdk/controller/common.rb +202 -0
  20. data/lib/chime_sdk/controller/meetings.rb +192 -0
  21. data/lib/chime_sdk/meeting_coordinator.rb +184 -0
  22. data/lib/chime_sdk/version.rb +4 -0
  23. data/lib/generators/chime_sdk/controllers_generator.rb +104 -0
  24. data/lib/generators/chime_sdk/install_generator.rb +27 -0
  25. data/lib/generators/chime_sdk/js_generator.rb +67 -0
  26. data/lib/generators/chime_sdk/views_generator.rb +43 -0
  27. data/lib/generators/templates/chime_sdk.rb +28 -0
  28. data/lib/generators/templates/controllers/README +35 -0
  29. data/lib/generators/templates/controllers/meeting_attendees_controller.rb +106 -0
  30. data/lib/generators/templates/controllers/meetings_controller.rb +146 -0
  31. data/lib/generators/templates/views/meetings/index.html.erb +27 -0
  32. data/lib/generators/templates/views/meetings/show.html.erb +136 -0
  33. data/spec/factories/rooms.rb +5 -0
  34. data/spec/factories/users.rb +8 -0
  35. data/spec/generators/controllers_generator_spec.rb +113 -0
  36. data/spec/generators/install_generator_spec.rb +24 -0
  37. data/spec/generators/js_generator_spec.rb +26 -0
  38. data/spec/generators/views_generator_spec.rb +46 -0
  39. data/spec/rails_app/Rakefile +15 -0
  40. data/spec/rails_app/app/assets/config/manifest.js +2 -0
  41. data/spec/rails_app/app/assets/images/.keep +0 -0
  42. data/spec/rails_app/app/assets/javascripts/.keep +0 -0
  43. data/spec/rails_app/app/assets/stylesheets/application.css +15 -0
  44. data/spec/rails_app/app/assets/stylesheets/scaffolds.scss +65 -0
  45. data/spec/rails_app/app/controllers/api/meeting_attendees_controller.rb +3 -0
  46. data/spec/rails_app/app/controllers/api/meetings_controller.rb +3 -0
  47. data/spec/rails_app/app/controllers/api/rooms_controller.rb +3 -0
  48. data/spec/rails_app/app/controllers/application_controller.rb +11 -0
  49. data/spec/rails_app/app/controllers/entries_controller.rb +47 -0
  50. data/spec/rails_app/app/controllers/meeting_attendees_controller.rb +121 -0
  51. data/spec/rails_app/app/controllers/meetings_controller.rb +162 -0
  52. data/spec/rails_app/app/controllers/rooms_controller.rb +76 -0
  53. data/spec/rails_app/app/controllers/spa_controller.rb +6 -0
  54. data/spec/rails_app/app/javascript/App.vue +50 -0
  55. data/spec/rails_app/app/javascript/channels/consumer.js +6 -0
  56. data/spec/rails_app/app/javascript/channels/index.js +5 -0
  57. data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +84 -0
  58. data/spec/rails_app/app/javascript/components/meetings/Index.vue +100 -0
  59. data/spec/rails_app/app/javascript/components/meetings/Meeting.vue +178 -0
  60. data/spec/rails_app/app/javascript/components/rooms/Index.vue +53 -0
  61. data/spec/rails_app/app/javascript/components/rooms/Show.vue +91 -0
  62. data/spec/rails_app/app/javascript/packs/application.js +17 -0
  63. data/spec/rails_app/app/javascript/packs/spa.js +14 -0
  64. data/spec/rails_app/app/javascript/router/index.js +74 -0
  65. data/spec/rails_app/app/javascript/store/index.js +37 -0
  66. data/spec/rails_app/app/models/application_record.rb +3 -0
  67. data/spec/rails_app/app/models/entry.rb +5 -0
  68. data/spec/rails_app/app/models/room.rb +12 -0
  69. data/spec/rails_app/app/models/user.rb +6 -0
  70. data/spec/rails_app/app/views/devise/registrations/new.html.erb +34 -0
  71. data/spec/rails_app/app/views/layouts/_header.html.erb +20 -0
  72. data/spec/rails_app/app/views/layouts/application.html.erb +18 -0
  73. data/spec/rails_app/app/views/meetings/index.html.erb +28 -0
  74. data/spec/rails_app/app/views/meetings/show.html.erb +136 -0
  75. data/spec/rails_app/app/views/rooms/_form.html.erb +22 -0
  76. data/spec/rails_app/app/views/rooms/_room.json.jbuilder +7 -0
  77. data/spec/rails_app/app/views/rooms/edit.html.erb +6 -0
  78. data/spec/rails_app/app/views/rooms/index.html.erb +27 -0
  79. data/spec/rails_app/app/views/rooms/index.json.jbuilder +1 -0
  80. data/spec/rails_app/app/views/rooms/new.html.erb +5 -0
  81. data/spec/rails_app/app/views/rooms/show.html.erb +42 -0
  82. data/spec/rails_app/app/views/rooms/show.json.jbuilder +1 -0
  83. data/spec/rails_app/app/views/spa/index.html.erb +1 -0
  84. data/spec/rails_app/babel.config.js +72 -0
  85. data/spec/rails_app/bin/bundle +114 -0
  86. data/spec/rails_app/bin/rails +9 -0
  87. data/spec/rails_app/bin/rake +9 -0
  88. data/spec/rails_app/bin/setup +36 -0
  89. data/spec/rails_app/bin/spring +17 -0
  90. data/spec/rails_app/bin/webpack +18 -0
  91. data/spec/rails_app/bin/webpack-dev-server +18 -0
  92. data/spec/rails_app/bin/yarn +11 -0
  93. data/spec/rails_app/config.ru +5 -0
  94. data/spec/rails_app/config/application.rb +21 -0
  95. data/spec/rails_app/config/boot.rb +4 -0
  96. data/spec/rails_app/config/cable.yml +10 -0
  97. data/spec/rails_app/config/credentials.yml.enc +1 -0
  98. data/spec/rails_app/config/database.yml +25 -0
  99. data/spec/rails_app/config/environment.rb +14 -0
  100. data/spec/rails_app/config/environments/development.rb +62 -0
  101. data/spec/rails_app/config/environments/production.rb +112 -0
  102. data/spec/rails_app/config/environments/test.rb +49 -0
  103. data/spec/rails_app/config/initializers/application_controller_renderer.rb +8 -0
  104. data/spec/rails_app/config/initializers/assets.rb +15 -0
  105. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  106. data/spec/rails_app/config/initializers/chime_sdk.rb +28 -0
  107. data/spec/rails_app/config/initializers/content_security_policy.rb +30 -0
  108. data/spec/rails_app/config/initializers/cookies_serializer.rb +5 -0
  109. data/spec/rails_app/config/initializers/devise.rb +311 -0
  110. data/spec/rails_app/config/initializers/devise_token_auth.rb +60 -0
  111. data/spec/rails_app/config/initializers/filter_parameter_logging.rb +4 -0
  112. data/spec/rails_app/config/initializers/inflections.rb +16 -0
  113. data/spec/rails_app/config/initializers/mime_types.rb +4 -0
  114. data/spec/rails_app/config/initializers/wrap_parameters.rb +14 -0
  115. data/spec/rails_app/config/locales/devise.en.yml +65 -0
  116. data/spec/rails_app/config/locales/en.yml +33 -0
  117. data/spec/rails_app/config/puma.rb +38 -0
  118. data/spec/rails_app/config/routes.rb +24 -0
  119. data/spec/rails_app/config/secrets.yml +8 -0
  120. data/spec/rails_app/config/spring.rb +6 -0
  121. data/spec/rails_app/config/storage.yml +34 -0
  122. data/spec/rails_app/config/webpack/development.js +5 -0
  123. data/spec/rails_app/config/webpack/environment.js +7 -0
  124. data/spec/rails_app/config/webpack/loaders/vue.js +6 -0
  125. data/spec/rails_app/config/webpack/production.js +5 -0
  126. data/spec/rails_app/config/webpack/test.js +5 -0
  127. data/spec/rails_app/config/webpacker.yml +97 -0
  128. data/spec/rails_app/db/migrate/20200912140231_devise_create_users.rb +45 -0
  129. data/spec/rails_app/db/migrate/20200912140352_add_tokens_to_users.rb +12 -0
  130. data/spec/rails_app/db/migrate/20200912140657_create_rooms.rb +9 -0
  131. data/spec/rails_app/db/migrate/20200912140749_create_entries.rb +10 -0
  132. data/spec/rails_app/db/schema.rb +49 -0
  133. data/spec/rails_app/db/seeds.rb +41 -0
  134. data/spec/rails_app/log/.keep +0 -0
  135. data/spec/rails_app/package.json +23 -0
  136. data/spec/rails_app/postcss.config.js +12 -0
  137. data/spec/rails_app/public/404.html +67 -0
  138. data/spec/rails_app/public/422.html +67 -0
  139. data/spec/rails_app/public/500.html +66 -0
  140. data/spec/rails_app/public/favicon.ico +0 -0
  141. data/spec/rails_app/public/robots.txt +1 -0
  142. data/spec/rails_app/tmp/.keep +0 -0
  143. data/spec/requests/atendees_spec.rb +182 -0
  144. data/spec/requests/meetings_spec.rb +433 -0
  145. data/spec/spec_helper.rb +35 -0
  146. metadata +400 -0
@@ -0,0 +1,433 @@
1
+ describe ChimeSdk::Controller::Meetings, type: :request do
2
+ before(:all) do
3
+ @meeting_id = "01234567-89ab-cdef-ghij-klmnopqrstuv"
4
+ @attendee_id = "76543210-ba98-fedc-jihg-vutsrqponmlk"
5
+ @dummy_meeting_id = "91234567-89ab-cdef-ghij-klmnopqrstuv"
6
+
7
+ @room = create(:room)
8
+ dummy_media_placement = {
9
+ audio_host_url: "dummy",
10
+ audio_fallback_url: "dummy",
11
+ screen_data_url: "dummy",
12
+ screen_sharing_url: "dummy",
13
+ screen_viewing_url: "dummy",
14
+ signaling_url: "dummy",
15
+ turn_control_url: "dummy"
16
+ }
17
+ test_meeting = {
18
+ meeting_id: @meeting_id,
19
+ external_meeting_id: "ChimeSdkRailsApp-test-PrivateRoom-#{@room.id}",
20
+ media_placement: dummy_media_placement,
21
+ media_region: "us-east-1"
22
+ }
23
+ dummy_meeting = {
24
+ meeting_id: @dummy_meeting_id,
25
+ external_meeting_id: "ChimeSdkRailsApp-test-PrivateRoom-0",
26
+ media_placement: dummy_media_placement,
27
+ media_region: "us-east-1"
28
+ }
29
+
30
+ # Use stubs for the AWS SDK for Ruby
31
+ client = Aws::Chime::Client.new(stub_responses: true)
32
+ client.stub_responses(:list_meetings, {
33
+ meetings: [ test_meeting, dummy_meeting ]
34
+ })
35
+ client.stub_responses(:get_meeting, -> (context) {
36
+ context.params[:meeting_id] == @meeting_id ? { meeting: test_meeting } : 'NotFoundException'
37
+ })
38
+ client.stub_responses(:create_meeting, {
39
+ meeting: test_meeting
40
+ })
41
+ client.stub_responses(:delete_meeting, -> (context) {
42
+ context.params[:meeting_id] == @meeting_id ? {} : 'NotFoundException'
43
+ })
44
+ client.stub_responses(:create_attendee, -> (context) {
45
+ context.params[:meeting_id] == @meeting_id ? {
46
+ attendee: {
47
+ external_user_id: context.params[:external_user_id],
48
+ attendee_id: @attendee_id,
49
+ join_token: "dummy"
50
+ }
51
+ } : 'BadRequestException'
52
+ })
53
+ ChimeSdk::MeetingCoordinator.reset_client(client)
54
+ end
55
+
56
+ context "Rails API" do
57
+ let(:api_root_path) { "/api/v1" }
58
+ let(:api_path) { "#{api_root_path}/rooms/#{@room.id}" }
59
+
60
+ before do
61
+ @user = create(:user)
62
+ end
63
+
64
+ context "requests from unauthorized user" do
65
+ describe "GET /meetings" do
66
+ it "returns response with 401 status" do
67
+ get "#{api_path}/meetings", headers: @auth_headers
68
+ expect(response).to have_http_status(401)
69
+ end
70
+ end
71
+ end
72
+
73
+ context "requests from authorized user" do
74
+ before do
75
+ # Sign in with Devise Token Auth
76
+ post "#{api_root_path}/auth/sign_in", params: { email: @user.email, password: "password" }
77
+ @auth_headers = response.header.slice("access-token", "client", "uid")
78
+ end
79
+
80
+ context "when the authorized user is not a member of the private room" do
81
+ describe "GET /meetings" do
82
+ it "returns response with 403 status" do
83
+ get "#{api_path}/meetings", headers: @auth_headers
84
+ expect(response).to have_http_status(403)
85
+ end
86
+ end
87
+ end
88
+
89
+ context "when the authorized user is a member of the private room" do
90
+ before do
91
+ @room.add_member(@user)
92
+ end
93
+
94
+ describe "GET /meetings" do
95
+ context "without any parameters and ChimeSdk.config.create_meeting_by_get_request is disabled" do
96
+ before do
97
+ get "#{api_path}/meetings", headers: @auth_headers
98
+ end
99
+
100
+ it "returns response with 200 status" do
101
+ expect(response).to have_http_status(200)
102
+ end
103
+
104
+ it "returns meetings list filtered by prefix" do
105
+ expect(JSON.parse(response.body)["meetings"].length).to eq(1)
106
+ end
107
+
108
+ it "returns valid meeting in the list" do
109
+ expect(JSON.parse(response.body)["meetings"][0]["Meeting"]["MeetingId"]).to eq(@meeting_id)
110
+ end
111
+ end
112
+
113
+ context "with true as create_meeting parameter" do
114
+ before do
115
+ get "#{api_path}/meetings", headers: @auth_headers, params: { create_meeting: true }
116
+ end
117
+
118
+ it "returns response with 201 status" do
119
+ expect(response).to have_http_status(201)
120
+ end
121
+
122
+ it "returns created meeting" do
123
+ expect(JSON.parse(response.body)["Meeting"]["MeetingId"]).to eq(@meeting_id)
124
+ end
125
+ end
126
+ end
127
+
128
+ describe "GET /meetings/:meeting_id" do
129
+ context "when the meeting is found" do
130
+ before do
131
+ get "#{api_path}/meetings/#{@meeting_id}", headers: @auth_headers
132
+ end
133
+
134
+ it "returns response with 200 status" do
135
+ expect(response).to have_http_status(200)
136
+ end
137
+
138
+ it "returns valid meeting" do
139
+ expect(JSON.parse(response.body)["Meeting"]["MeetingId"]).to eq(@meeting_id)
140
+ end
141
+
142
+ it "returns application metadata in the meeting" do
143
+ expect(JSON.parse(response.body)["Meeting"]["ApplicationMetadata"]["Room"]["id"]).to eq(@room.id)
144
+ end
145
+
146
+ it "returns created attendee since ChimeSdk.config.create_attendee_from_meeting is enabled" do
147
+ expect(JSON.parse(response.body)["Attendee"]["AttendeeId"]).to eq(@attendee_id)
148
+ end
149
+ end
150
+
151
+ context "when the meeting is not found" do
152
+ before do
153
+ get "#{api_path}/meetings/#{@dummy_meeting_id}", headers: @auth_headers
154
+ end
155
+
156
+ it "returns response with 404 status" do
157
+ expect(response).to have_http_status(404)
158
+ end
159
+ end
160
+ end
161
+
162
+ describe "POST /meetings" do
163
+ context "when ChimeSdk.config.create_meeting_with_attendee is enabled" do
164
+ before do
165
+ post "#{api_path}/meetings", headers: @auth_headers
166
+ end
167
+
168
+ it "returns response with 201 status" do
169
+ expect(response).to have_http_status(201)
170
+ end
171
+
172
+ it "returns created meeting" do
173
+ expect(JSON.parse(response.body)["Meeting"]["MeetingId"]).to eq(@meeting_id)
174
+ end
175
+
176
+ it "returns created attendee" do
177
+ expect(JSON.parse(response.body)["Attendee"]["AttendeeId"]).to eq(@attendee_id)
178
+ end
179
+ end
180
+
181
+ context "when ChimeSdk.config.create_meeting_with_attendee is disabled" do
182
+ before do
183
+ ChimeSdk.config.create_meeting_with_attendee = false
184
+ post "#{api_path}/meetings", headers: @auth_headers
185
+ end
186
+
187
+ after do
188
+ ChimeSdk.config.create_meeting_with_attendee = true
189
+ end
190
+
191
+ it "returns response with 201 status" do
192
+ expect(response).to have_http_status(201)
193
+ end
194
+
195
+ it "returns created meeting" do
196
+ expect(JSON.parse(response.body)["Meeting"]["MeetingId"]).to eq(@meeting_id)
197
+ end
198
+
199
+ it "does not return created attendee" do
200
+ expect(JSON.parse(response.body)["Attendee"]).to be_nil
201
+ end
202
+ end
203
+ end
204
+
205
+ describe "DELETE /meetings/:meeting_id" do
206
+ context "when the meeting is found" do
207
+ before do
208
+ delete "#{api_path}/meetings/#{@meeting_id}", headers: @auth_headers
209
+ end
210
+
211
+ it "returns response with 204 status" do
212
+ expect(response).to have_http_status(204)
213
+ end
214
+ end
215
+
216
+ context "when the meeting is not found" do
217
+ before do
218
+ get "#{api_path}/meetings/#{@dummy_meeting_id}", headers: @auth_headers
219
+ end
220
+
221
+ it "returns response with 404 status" do
222
+ expect(response).to have_http_status(404)
223
+ end
224
+ end
225
+ end
226
+ end
227
+ end
228
+ end
229
+
230
+ context "Rails View" do
231
+ let(:api_path) { "/rooms/#{@room.id}" }
232
+
233
+ before do
234
+ @user = create(:user)
235
+ end
236
+
237
+ context "requests from unauthorized user" do
238
+ describe "GET /meetings" do
239
+ before do
240
+ get "#{api_path}/meetings"
241
+ end
242
+
243
+ it "returns response with 302 status" do
244
+ expect(response).to have_http_status(302)
245
+ end
246
+
247
+ it "redirects to user sign_in path" do
248
+ expect(response.body).to redirect_to("/users/sign_in")
249
+ end
250
+ end
251
+ end
252
+
253
+ context "requests from authorized user" do
254
+ before do
255
+ # Sign in with Devise
256
+ sign_in @user
257
+ end
258
+
259
+ context "when the authorized user is not a member of the private room" do
260
+ describe "GET /meetings" do
261
+ before do
262
+ get "#{api_path}/meetings"
263
+ end
264
+
265
+ it "returns response with 302 status" do
266
+ expect(response).to have_http_status(302)
267
+ end
268
+
269
+ it "redirects to parent resource path" do
270
+ expect(response.body).to redirect_to(api_path)
271
+ end
272
+ end
273
+ end
274
+
275
+ context "when the authorized user is a member of the private room" do
276
+ before do
277
+ @room.add_member(@user)
278
+ end
279
+
280
+ describe "GET /meetings" do
281
+ context "without any parameters and ChimeSdk.config.create_meeting_by_get_request is disabled" do
282
+ before do
283
+ get "#{api_path}/meetings"
284
+ end
285
+
286
+ it "returns response with 200 status" do
287
+ expect(response).to have_http_status(200)
288
+ expect(response.body).to include("Meetings by Amazon Chime SDK")
289
+ end
290
+
291
+ it "returns valid meeting in the list" do
292
+ expect(response.body).to include(@meeting_id)
293
+ end
294
+ end
295
+
296
+ context "with true as create_meeting parameter" do
297
+ before do
298
+ get "#{api_path}/meetings", params: { create_meeting: true }
299
+ end
300
+
301
+ it "returns response with 302 status" do
302
+ expect(response).to have_http_status(302)
303
+ end
304
+
305
+ it "redirects to created meeting path" do
306
+ expect(response.body).to redirect_to("#{api_path}/meetings/#{@meeting_id}")
307
+ end
308
+ end
309
+ end
310
+
311
+ describe "GET /meetings/:meeting_id" do
312
+ context "when the meeting is found" do
313
+ before do
314
+ get "#{api_path}/meetings/#{@meeting_id}"
315
+ end
316
+
317
+ it "returns response with 200 status" do
318
+ expect(response).to have_http_status(200)
319
+ expect(response.body).to include("Meeting by Amazon Chime SDK")
320
+ end
321
+
322
+ it "returns valid meeting" do
323
+ expect(response.body).to include(@meeting_id)
324
+ end
325
+
326
+ it "returns created attendee since ChimeSdk.config.create_attendee_from_meeting is enabled" do
327
+ expect(response.body).to include(@attendee_id)
328
+ end
329
+ end
330
+
331
+ context "when the meeting is not found" do
332
+ before do
333
+ get "#{api_path}/meetings/#{@dummy_meeting_id}"
334
+ end
335
+
336
+ it "returns response with 302 status" do
337
+ expect(response).to have_http_status(302)
338
+ end
339
+
340
+ it "redirects to meetings path" do
341
+ expect(response.body).to redirect_to("#{api_path}/meetings")
342
+ end
343
+
344
+ it "returns resource_not_found error as notice" do
345
+ expect(flash[:notice]).to include("Resource not found")
346
+ end
347
+ end
348
+ end
349
+
350
+ describe "POST /meetings" do
351
+ context "when ChimeSdk.config.create_meeting_with_attendee is enabled" do
352
+ before do
353
+ post "#{api_path}/meetings"
354
+ end
355
+
356
+ it "returns response with 302 status" do
357
+ expect(response).to have_http_status(302)
358
+ end
359
+
360
+ it "redirects to created meeting path" do
361
+ expect(response.body).to redirect_to("#{api_path}/meetings/#{@meeting_id}")
362
+ end
363
+
364
+ it "returns created message as notice" do
365
+ expect(flash[:notice]).to include("Meeting <#{@meeting_id}> was successfully created")
366
+ end
367
+ end
368
+
369
+ context "when ChimeSdk.config.create_meeting_with_attendee is disabled" do
370
+ before do
371
+ ChimeSdk.config.create_meeting_with_attendee = false
372
+ post "#{api_path}/meetings"
373
+ end
374
+
375
+ after do
376
+ ChimeSdk.config.create_meeting_with_attendee = true
377
+ end
378
+
379
+ it "returns response with 302 status" do
380
+ expect(response).to have_http_status(302)
381
+ end
382
+
383
+ it "redirects to created meeting path" do
384
+ expect(response.body).to redirect_to("#{api_path}/meetings/#{@meeting_id}")
385
+ end
386
+
387
+ it "returns created message as notice" do
388
+ expect(flash[:notice]).to include("Meeting <#{@meeting_id}> was successfully created.")
389
+ end
390
+ end
391
+ end
392
+
393
+ describe "DELETE /meetings/:meeting_id" do
394
+ context "when the meeting is found" do
395
+ before do
396
+ delete "#{api_path}/meetings/#{@meeting_id}"
397
+ end
398
+
399
+ it "returns response with 302 status" do
400
+ expect(response).to have_http_status(302)
401
+ end
402
+
403
+ it "redirects to meetings path" do
404
+ expect(response.body).to redirect_to("#{api_path}/meetings")
405
+ end
406
+
407
+ it "returns resource_not_found error as notice" do
408
+ expect(flash[:notice]).to include("Meeting <#{@meeting_id}> was successfully destroyed.")
409
+ end
410
+ end
411
+
412
+ context "when the meeting is not found" do
413
+ before do
414
+ get "#{api_path}/meetings/#{@dummy_meeting_id}"
415
+ end
416
+
417
+ it "returns response with 302 status" do
418
+ expect(response).to have_http_status(302)
419
+ end
420
+
421
+ it "redirects to meetings path" do
422
+ expect(response.body).to redirect_to("#{api_path}/meetings")
423
+ end
424
+
425
+ it "returns resource_not_found error as notice" do
426
+ expect(flash[:notice]).to include("Resource not found")
427
+ end
428
+ end
429
+ end
430
+ end
431
+ end
432
+ end
433
+ end
@@ -0,0 +1,35 @@
1
+ ENV["RAILS_ENV"] ||= "test"
2
+
3
+ require 'simplecov'
4
+ require 'coveralls'
5
+ Coveralls.wear!
6
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [
7
+ SimpleCov::Formatter::HTMLFormatter,
8
+ Coveralls::SimpleCov::Formatter
9
+ ]
10
+ SimpleCov.start('rails') do
11
+ add_filter '/spec/'
12
+ add_filter '/lib/generators/templates/'
13
+ add_filter '/lib/chime_sdk/version'
14
+ end
15
+
16
+ # Test Rails application
17
+ require 'rails_app/config/environment'
18
+
19
+ def clean_database
20
+ [Entry, Room, User].each do |model|
21
+ model.delete_all
22
+ end
23
+ end
24
+
25
+ require 'rspec/rails'
26
+ require 'factory_bot_rails'
27
+ require 'ammeter/init'
28
+ RSpec.configure do |config|
29
+ config.include Devise::Test::IntegrationHelpers, type: :request
30
+ config.include FactoryBot::Syntax::Methods
31
+ config.before(:all) do
32
+ FactoryBot.reload
33
+ clean_database
34
+ end
35
+ end