bigbluebutton_rails 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.rdoc +11 -0
- data/Gemfile.lock +1 -1
- data/README.rdoc +46 -32
- data/Rakefile +0 -1
- data/app/controllers/bigbluebutton/rooms_controller.rb +17 -16
- data/app/controllers/bigbluebutton/servers_controller.rb +6 -2
- data/app/models/bigbluebutton_room.rb +35 -1
- data/app/models/bigbluebutton_server.rb +1 -1
- data/app/views/bigbluebutton/rooms/_form.html.erb +7 -3
- data/app/views/bigbluebutton/rooms/_rooms.html.erb +37 -0
- data/app/views/bigbluebutton/rooms/edit.html.erb +2 -2
- data/app/views/bigbluebutton/rooms/external.html.erb +2 -1
- data/app/views/bigbluebutton/rooms/index.html.erb +2 -37
- data/app/views/bigbluebutton/rooms/invite.html.erb +2 -2
- data/app/views/bigbluebutton/rooms/join.html.erb +1 -1
- data/app/views/bigbluebutton/rooms/new.html.erb +1 -1
- data/app/views/bigbluebutton/rooms/show.html.erb +10 -4
- data/app/views/bigbluebutton/servers/_activity_list.html.erb +6 -6
- data/app/views/bigbluebutton/servers/index.html.erb +4 -3
- data/app/views/bigbluebutton/servers/rooms.html.erb +2 -0
- data/app/views/bigbluebutton/servers/show.html.erb +3 -4
- data/config/locales/en.yml +7 -3
- data/lib/bigbluebutton_rails/exceptions.rb +4 -0
- data/lib/bigbluebutton_rails/rails/routes.rb +28 -35
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +13 -10
- data/spec/controllers/bigbluebutton/rooms_controller_json_responses_spec.rb +13 -13
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +114 -115
- data/spec/controllers/bigbluebutton/servers_controller_json_responses_spec.rb +12 -1
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +11 -0
- data/spec/generators/install_generator_spec.rb +1 -1
- data/spec/models/bigbluebutton_room_spec.rb +166 -80
- data/spec/models/bigbluebutton_server_spec.rb +4 -4
- data/spec/rails_app/features/activity_monitor_servers.feature +6 -0
- data/spec/rails_app/features/create_rooms.feature +5 -0
- data/spec/rails_app/features/create_servers.feature +7 -2
- data/spec/rails_app/features/edit_rooms.feature +7 -0
- data/spec/rails_app/features/edit_servers.feature +8 -2
- data/spec/rails_app/features/join_rooms.feature +1 -0
- data/spec/rails_app/features/list_and_show_rooms.feature +10 -2
- data/spec/rails_app/features/step_definitions/activity_monitor_servers_step.rb +10 -10
- data/spec/rails_app/features/step_definitions/common_steps.rb +6 -4
- data/spec/rails_app/features/step_definitions/create_rooms_steps.rb +1 -0
- data/spec/rails_app/features/step_definitions/join_mobile_steps.rb +1 -3
- data/spec/rails_app/features/step_definitions/join_rooms_steps.rb +3 -7
- data/spec/rails_app/features/step_definitions/list_and_show_rooms_steps.rb +12 -5
- data/spec/rails_app/features/step_definitions/list_and_show_servers_steps.rb +1 -5
- data/spec/rails_app/features/support/{application_controller.rb → patches/application_controller.rb} +0 -0
- data/spec/rails_app/features/support/patches/bigbluebutton_room.rb +9 -0
- data/spec/rails_app/features/support/paths.rb +12 -10
- data/spec/rails_app/features/support/templates.rb +90 -46
- data/spec/routing/bigbluebutton/custom_controllers_routing_spec.rb +38 -22
- data/spec/routing/bigbluebutton/rooms_routing_spec.rb +142 -58
- data/spec/routing/bigbluebutton/servers_routing_spec.rb +9 -1
- metadata +11 -8
@@ -10,55 +10,48 @@ describe Bigbluebutton::RoomsController do
|
|
10
10
|
let(:room) { Factory.create(:bigbluebutton_room, :server => server) }
|
11
11
|
|
12
12
|
describe "#index" do
|
13
|
-
before(:each) { get :index
|
13
|
+
before(:each) { get :index }
|
14
14
|
it { should respond_with(:success) }
|
15
|
-
it { should assign_to(:server).with(server) }
|
16
15
|
it { should assign_to(:rooms).with(BigbluebuttonRoom.all) }
|
17
16
|
it { should render_template(:index) }
|
18
17
|
end
|
19
18
|
|
20
19
|
describe "#show" do
|
21
|
-
before(:each) { get :show, :
|
20
|
+
before(:each) { get :show, :id => room.to_param }
|
22
21
|
it { should respond_with(:success) }
|
23
|
-
it { should assign_to(:server).with(server) }
|
24
22
|
it { should assign_to(:room).with(room) }
|
25
23
|
it { should render_template(:show) }
|
26
24
|
end
|
27
25
|
|
28
26
|
describe "#new" do
|
29
|
-
before(:each) { get :new
|
27
|
+
before(:each) { get :new }
|
30
28
|
it { should respond_with(:success) }
|
31
|
-
it { should assign_to(:server).with(server) }
|
32
29
|
it { should assign_to(:room).with_kind_of(BigbluebuttonRoom) }
|
33
30
|
it { should render_template(:new) }
|
34
31
|
end
|
35
32
|
|
36
33
|
describe "#edit" do
|
37
|
-
before(:each) { get :edit, :
|
34
|
+
before(:each) { get :edit, :id => room.to_param }
|
38
35
|
it { should respond_with(:success) }
|
39
|
-
it { should assign_to(:server).with(server) }
|
40
36
|
it { should assign_to(:room).with(room) }
|
41
37
|
it { should render_template(:edit) }
|
42
38
|
end
|
43
39
|
|
44
40
|
describe "#join_mobile" do
|
45
41
|
let(:user) { Factory.build(:user) }
|
46
|
-
let(:
|
47
|
-
let(:room) { Factory.create(:bigbluebutton_room, :server => server) }
|
42
|
+
let(:room) { Factory.create(:bigbluebutton_room) }
|
48
43
|
before {
|
49
44
|
mock_server_and_api
|
45
|
+
room.server = mocked_server
|
50
46
|
controller.stub(:bigbluebutton_user) { user }
|
51
47
|
controller.should_receive(:bigbluebutton_role).and_return(:moderator)
|
52
|
-
controller.should_receive(:
|
53
|
-
with(mocked_server, room, :mobile => '1').
|
48
|
+
controller.should_receive(:join_bigbluebutton_room_url).with(room, :mobile => '1').
|
54
49
|
and_return("http://test.com/join/url?mobile=1")
|
55
|
-
mocked_api.should_receive(:join_meeting_url).
|
56
|
-
with(room.meetingid, user.name, room.moderator_password).
|
50
|
+
mocked_api.should_receive(:join_meeting_url).with(room.meetingid, user.name, room.moderator_password).
|
57
51
|
and_return("bigbluebutton://test.com/open/url/for/qrcode")
|
58
52
|
}
|
59
|
-
before(:each) { get :join_mobile, :
|
53
|
+
before(:each) { get :join_mobile, :id => room.to_param }
|
60
54
|
it { should respond_with(:success) }
|
61
|
-
it { should assign_to(:server).with(mocked_server) }
|
62
55
|
it { should assign_to(:room).with(room) }
|
63
56
|
it { should assign_to(:join_url).with("bigbluebutton://test.com/join/url?mobile=1") }
|
64
57
|
it { should assign_to(:qrcode_url).with("bigbluebutton://test.com/open/url/for/qrcode") }
|
@@ -71,15 +64,14 @@ describe Bigbluebutton::RoomsController do
|
|
71
64
|
context "on success" do
|
72
65
|
before :each do
|
73
66
|
expect {
|
74
|
-
post :create, :
|
67
|
+
post :create, :bigbluebutton_room => new_room.attributes
|
75
68
|
}.to change{ BigbluebuttonRoom.count }.by(1)
|
76
69
|
end
|
77
70
|
it {
|
78
71
|
should respond_with(:redirect)
|
79
|
-
should redirect_to
|
72
|
+
should redirect_to bigbluebutton_room_path(BigbluebuttonRoom.last)
|
80
73
|
}
|
81
74
|
it { should set_the_flash.to(I18n.t('bigbluebutton_rails.rooms.notice.create.success')) }
|
82
|
-
it { should assign_to(:server).with(server) }
|
83
75
|
it {
|
84
76
|
saved = BigbluebuttonRoom.last
|
85
77
|
saved.should have_same_attributes_as(new_room)
|
@@ -90,18 +82,16 @@ describe Bigbluebutton::RoomsController do
|
|
90
82
|
before :each do
|
91
83
|
new_room.name = nil # invalid
|
92
84
|
expect {
|
93
|
-
post :create, :
|
85
|
+
post :create, :bigbluebutton_room => new_room.attributes
|
94
86
|
}.not_to change{ BigbluebuttonRoom.count }
|
95
87
|
end
|
96
88
|
it { should render_template(:new) }
|
97
|
-
it { should assign_to(:server).with(server) }
|
98
89
|
end
|
99
90
|
|
100
91
|
context "with :redir_url" do
|
101
92
|
it "on success" do
|
102
93
|
expect {
|
103
|
-
post :create, :
|
104
|
-
:redir_url => bigbluebutton_servers_path
|
94
|
+
post :create, :bigbluebutton_room => new_room.attributes, :redir_url => bigbluebutton_servers_path
|
105
95
|
}.to change{ BigbluebuttonRoom.count }.by(1)
|
106
96
|
should respond_with(:redirect)
|
107
97
|
should redirect_to bigbluebutton_servers_path
|
@@ -109,8 +99,7 @@ describe Bigbluebutton::RoomsController do
|
|
109
99
|
it "on failure" do
|
110
100
|
new_room.name = nil # invalid
|
111
101
|
expect {
|
112
|
-
post :create, :
|
113
|
-
:redir_url => bigbluebutton_servers_path
|
102
|
+
post :create, :bigbluebutton_room => new_room.attributes, :redir_url => bigbluebutton_servers_path
|
114
103
|
}.not_to change{ BigbluebuttonRoom.count }
|
115
104
|
should respond_with(:redirect)
|
116
105
|
should redirect_to bigbluebutton_servers_path
|
@@ -121,7 +110,7 @@ describe Bigbluebutton::RoomsController do
|
|
121
110
|
before :each do
|
122
111
|
attr = new_room.attributes
|
123
112
|
attr.delete("meetingid")
|
124
|
-
post :create, :
|
113
|
+
post :create, :bigbluebutton_room => attr
|
125
114
|
end
|
126
115
|
it {
|
127
116
|
saved = BigbluebuttonRoom.last
|
@@ -138,42 +127,40 @@ describe Bigbluebutton::RoomsController do
|
|
138
127
|
context "on success" do
|
139
128
|
before :each do
|
140
129
|
expect {
|
141
|
-
put :update, :
|
130
|
+
put :update, :id => @room.to_param, :bigbluebutton_room => new_room.attributes
|
142
131
|
}.not_to change{ BigbluebuttonRoom.count }
|
143
132
|
end
|
144
133
|
it {
|
145
134
|
saved = BigbluebuttonRoom.find(@room)
|
146
135
|
should respond_with(:redirect)
|
147
|
-
should redirect_to
|
136
|
+
should redirect_to bigbluebutton_room_path(saved)
|
148
137
|
}
|
149
138
|
it {
|
150
139
|
saved = BigbluebuttonRoom.find(@room)
|
151
140
|
saved.should have_same_attributes_as(new_room)
|
152
141
|
}
|
153
142
|
it { should set_the_flash.to(I18n.t('bigbluebutton_rails.rooms.notice.update.success')) }
|
154
|
-
it { should assign_to(:server).with(server) }
|
155
143
|
end
|
156
144
|
|
157
145
|
context "on failure" do
|
158
146
|
before :each do
|
159
147
|
new_room.name = nil # invalid
|
160
|
-
put :update, :
|
148
|
+
put :update, :id => @room.to_param, :bigbluebutton_room => new_room.attributes
|
161
149
|
end
|
162
150
|
it { should render_template(:edit) }
|
163
|
-
it { should assign_to(:server).with(server) }
|
164
151
|
it { should assign_to(:room).with(@room) }
|
165
152
|
end
|
166
153
|
|
167
154
|
context "with :redir_url" do
|
168
155
|
it "on success" do
|
169
|
-
put :update, :
|
156
|
+
put :update, :id => @room.to_param, :bigbluebutton_room => new_room.attributes,
|
170
157
|
:redir_url => bigbluebutton_servers_path
|
171
158
|
should respond_with(:redirect)
|
172
159
|
should redirect_to bigbluebutton_servers_path
|
173
160
|
end
|
174
161
|
it "on failure" do
|
175
162
|
new_room.name = nil # invalid
|
176
|
-
put :update, :
|
163
|
+
put :update, :id => @room.to_param, :bigbluebutton_room => new_room.attributes,
|
177
164
|
:redir_url => bigbluebutton_servers_path
|
178
165
|
should respond_with(:redirect)
|
179
166
|
should redirect_to bigbluebutton_servers_path
|
@@ -184,7 +171,7 @@ describe Bigbluebutton::RoomsController do
|
|
184
171
|
before :each do
|
185
172
|
attr = new_room.attributes
|
186
173
|
attr.delete("meetingid")
|
187
|
-
put :update, :
|
174
|
+
put :update, :id => @room.to_param, :bigbluebutton_room => attr
|
188
175
|
end
|
189
176
|
it {
|
190
177
|
saved = BigbluebuttonRoom.find(@room)
|
@@ -206,20 +193,18 @@ describe Bigbluebutton::RoomsController do
|
|
206
193
|
context do
|
207
194
|
before :each do
|
208
195
|
expect {
|
209
|
-
delete :destroy, :
|
196
|
+
delete :destroy, :id => room.to_param
|
210
197
|
}.to change{ BigbluebuttonRoom.count }.by(-1)
|
211
198
|
end
|
212
199
|
it {
|
213
200
|
should respond_with(:redirect)
|
214
|
-
should redirect_to
|
201
|
+
should redirect_to bigbluebutton_rooms_url
|
215
202
|
}
|
216
|
-
it { should assign_to(:server).with(mocked_server) }
|
217
203
|
end
|
218
204
|
|
219
205
|
it "with :redir_url" do
|
220
206
|
expect {
|
221
|
-
delete :destroy, :
|
222
|
-
:redir_url => bigbluebutton_servers_path
|
207
|
+
delete :destroy, :id => room.to_param, :redir_url => bigbluebutton_servers_path
|
223
208
|
}.to change{ BigbluebuttonRoom.count }.by(-1)
|
224
209
|
should respond_with(:redirect)
|
225
210
|
should redirect_to bigbluebutton_servers_path
|
@@ -233,17 +218,16 @@ describe Bigbluebutton::RoomsController do
|
|
233
218
|
|
234
219
|
context "room is running" do
|
235
220
|
before { mocked_api.should_receive(:is_meeting_running?).and_return(true) }
|
236
|
-
before(:each) { get :running, :
|
221
|
+
before(:each) { get :running, :id => room.to_param }
|
237
222
|
it { should respond_with(:success) }
|
238
223
|
it { should respond_with_content_type(:json) }
|
239
|
-
it { should assign_to(:server).with(mocked_server) }
|
240
224
|
it { should assign_to(:room).with(room) }
|
241
225
|
it { response.body.should == build_running_json(true) }
|
242
226
|
end
|
243
227
|
|
244
228
|
context "room is not running" do
|
245
229
|
before { mocked_api.should_receive(:is_meeting_running?).and_return(false) }
|
246
|
-
before(:each) { get :running, :
|
230
|
+
before(:each) { get :running, :id => room.to_param }
|
247
231
|
it { response.body.should == build_running_json(false) }
|
248
232
|
end
|
249
233
|
end
|
@@ -255,10 +239,10 @@ describe Bigbluebutton::RoomsController do
|
|
255
239
|
context "for an anonymous user" do
|
256
240
|
before { controller.stub(:bigbluebutton_user) { nil } }
|
257
241
|
before { controller.stub(:bigbluebutton_role) { :moderator } }
|
258
|
-
before(:each) { get :join, :
|
242
|
+
before(:each) { get :join, :id => room.to_param }
|
259
243
|
it {
|
260
244
|
should respond_with(:redirect)
|
261
|
-
should redirect_to(
|
245
|
+
should redirect_to(invite_bigbluebutton_room_path(room))
|
262
246
|
}
|
263
247
|
end
|
264
248
|
|
@@ -267,16 +251,16 @@ describe Bigbluebutton::RoomsController do
|
|
267
251
|
|
268
252
|
context "should be defined with a password" do
|
269
253
|
before { controller.stub(:bigbluebutton_role) { :password } }
|
270
|
-
before(:each) { get :join, :
|
254
|
+
before(:each) { get :join, :id => room.to_param }
|
271
255
|
it { should respond_with(:redirect) }
|
272
|
-
it { should redirect_to(
|
256
|
+
it { should redirect_to(invite_bigbluebutton_room_path(room)) }
|
273
257
|
end
|
274
258
|
|
275
259
|
context "is undefined, the access should be blocked" do
|
276
260
|
before { controller.stub(:bigbluebutton_role) { nil } }
|
277
261
|
it {
|
278
262
|
lambda {
|
279
|
-
get :join, :
|
263
|
+
get :join, :id => room.to_param
|
280
264
|
}.should raise_error(BigbluebuttonRails::RoomAccessDenied)
|
281
265
|
}
|
282
266
|
end
|
@@ -286,7 +270,7 @@ describe Bigbluebutton::RoomsController do
|
|
286
270
|
# see support/shared_examples/rooms_controller.rb
|
287
271
|
context "calling .join_internal" do
|
288
272
|
let(:template) { :join }
|
289
|
-
let(:request) { get :join, :
|
273
|
+
let(:request) { get :join, :id => room.to_param }
|
290
274
|
before { controller.stub(:bigbluebutton_user).and_return(user) }
|
291
275
|
it_should_behave_like "internal join caller"
|
292
276
|
end
|
@@ -299,7 +283,7 @@ describe Bigbluebutton::RoomsController do
|
|
299
283
|
room.should_receive(:perform_join).and_return("http://test.com/join/url")
|
300
284
|
}
|
301
285
|
before(:each) {
|
302
|
-
get :join, :
|
286
|
+
get :join, :id => room.to_param, :mobile => "1"
|
303
287
|
}
|
304
288
|
it { should redirect_to("bigbluebutton://test.com/join/url") }
|
305
289
|
end
|
@@ -314,17 +298,16 @@ describe Bigbluebutton::RoomsController do
|
|
314
298
|
mocked_api.should_receive(:is_meeting_running?).and_return(true)
|
315
299
|
mocked_api.should_receive(:end_meeting).with(room.meetingid, room.moderator_password)
|
316
300
|
}
|
317
|
-
before(:each) { get :end, :
|
301
|
+
before(:each) { get :end, :id => room.to_param }
|
318
302
|
it { should respond_with(:redirect) }
|
319
|
-
it { should redirect_to(
|
320
|
-
it { should assign_to(:server).with(mocked_server) }
|
303
|
+
it { should redirect_to(bigbluebutton_room_path(room)) }
|
321
304
|
it { should assign_to(:room).with(room) }
|
322
305
|
it { should set_the_flash.to(I18n.t('bigbluebutton_rails.rooms.notice.end.success')) }
|
323
306
|
end
|
324
307
|
|
325
308
|
context "room is not running" do
|
326
309
|
before { mocked_api.should_receive(:is_meeting_running?).and_return(false) }
|
327
|
-
before(:each) { get :end, :
|
310
|
+
before(:each) { get :end, :id => room.to_param }
|
328
311
|
it { should respond_with(:redirect) }
|
329
312
|
it { should set_the_flash.to(I18n.t('bigbluebutton_rails.rooms.notice.end.not_running')) }
|
330
313
|
end
|
@@ -339,7 +322,7 @@ describe Bigbluebutton::RoomsController do
|
|
339
322
|
|
340
323
|
context "with a role defined" do
|
341
324
|
before { controller.stub(:bigbluebutton_role).and_return(:attendee) }
|
342
|
-
before(:each) { get :invite, :
|
325
|
+
before(:each) { get :invite, :id => room.to_param }
|
343
326
|
it { should respond_with(:success) }
|
344
327
|
it { should render_template(:invite) }
|
345
328
|
it { should assign_to(:room).with(room) }
|
@@ -348,7 +331,7 @@ describe Bigbluebutton::RoomsController do
|
|
348
331
|
context "when the user's role" do
|
349
332
|
context "should be defined with a password" do
|
350
333
|
before { controller.stub(:bigbluebutton_role) { :password } }
|
351
|
-
before(:each) { get :invite, :
|
334
|
+
before(:each) { get :invite, :id => room.to_param }
|
352
335
|
it { should respond_with(:success) }
|
353
336
|
it { should render_template(:invite) }
|
354
337
|
it { should assign_to(:room).with(room) }
|
@@ -358,7 +341,7 @@ describe Bigbluebutton::RoomsController do
|
|
358
341
|
before { controller.stub(:bigbluebutton_role) { nil } }
|
359
342
|
it {
|
360
343
|
lambda {
|
361
|
-
get :invite, :
|
344
|
+
get :invite, :id => room.to_param
|
362
345
|
}.should raise_error(BigbluebuttonRails::RoomAccessDenied)
|
363
346
|
}
|
364
347
|
end
|
@@ -370,15 +353,15 @@ describe Bigbluebutton::RoomsController do
|
|
370
353
|
|
371
354
|
context "with a role defined" do
|
372
355
|
before { controller.stub(:bigbluebutton_role).and_return(:attendee) }
|
373
|
-
before(:each) { get :invite, :
|
356
|
+
before(:each) { get :invite, :id => room.to_param }
|
374
357
|
it { should respond_with(:redirect) }
|
375
|
-
it { should redirect_to(
|
358
|
+
it { should redirect_to(join_bigbluebutton_room_path(room)) }
|
376
359
|
end
|
377
360
|
|
378
361
|
context "when the user's role" do
|
379
362
|
context "should be defined with a password" do
|
380
363
|
before { controller.stub(:bigbluebutton_role) { :password } }
|
381
|
-
before(:each) { get :invite, :
|
364
|
+
before(:each) { get :invite, :id => room.to_param }
|
382
365
|
it { should respond_with(:success) }
|
383
366
|
it { should render_template(:invite) }
|
384
367
|
it { should assign_to(:room).with(room) }
|
@@ -388,7 +371,7 @@ describe Bigbluebutton::RoomsController do
|
|
388
371
|
before { controller.stub(:bigbluebutton_role) { nil } }
|
389
372
|
it {
|
390
373
|
lambda {
|
391
|
-
get :invite, :
|
374
|
+
get :invite, :id => room.to_param
|
392
375
|
}.should raise_error(BigbluebuttonRails::RoomAccessDenied)
|
393
376
|
}
|
394
377
|
end
|
@@ -414,13 +397,13 @@ describe Bigbluebutton::RoomsController do
|
|
414
397
|
}
|
415
398
|
|
416
399
|
context "if params[:id]" do
|
417
|
-
before(:each) { post :auth, :
|
400
|
+
before(:each) { post :auth, :id => room.to_param, :user => user_hash }
|
418
401
|
it { should assign_to(:room).with(room) }
|
419
402
|
end
|
420
403
|
|
421
404
|
context "if params[:id] doesn't exists" do
|
422
405
|
let(:message) { I18n.t('bigbluebutton_rails.rooms.errors.auth.wrong_params') }
|
423
|
-
before(:each) { post :auth, :
|
406
|
+
before(:each) { post :auth, :id => "inexistent-room-id", :user => user_hash }
|
424
407
|
it { should assign_to(:room).with(nil) }
|
425
408
|
it { should respond_with(:redirect) }
|
426
409
|
it { should redirect_to(http_referer) }
|
@@ -433,7 +416,7 @@ describe Bigbluebutton::RoomsController do
|
|
433
416
|
before { controller.stub(:bigbluebutton_role) { nil } }
|
434
417
|
it {
|
435
418
|
lambda {
|
436
|
-
post :auth, :
|
419
|
+
post :auth, :id => room.to_param, :user => hash
|
437
420
|
}.should raise_error(BigbluebuttonRails::RoomAccessDenied)
|
438
421
|
}
|
439
422
|
end
|
@@ -446,14 +429,14 @@ describe Bigbluebutton::RoomsController do
|
|
446
429
|
mocked_api.should_receive(:join_meeting_url).
|
447
430
|
with(room.meetingid, user.name, room.attendee_password). # here's the validation
|
448
431
|
and_return("http://test.com/attendee/join")
|
449
|
-
post :auth, :
|
432
|
+
post :auth, :id => room.to_param, :user => hash
|
450
433
|
end
|
451
434
|
|
452
435
|
it "redirects to the correct join_url" do
|
453
436
|
hash = { :name => "Elftor", :password => room.attendee_password }
|
454
437
|
mocked_api.should_receive(:is_meeting_running?).and_return(true)
|
455
438
|
mocked_api.should_receive(:join_meeting_url).and_return("http://test.com/attendee/join")
|
456
|
-
post :auth, :
|
439
|
+
post :auth, :id => room.to_param, :user => hash
|
457
440
|
should respond_with(:redirect)
|
458
441
|
should redirect_to("http://test.com/attendee/join")
|
459
442
|
end
|
@@ -465,14 +448,14 @@ describe Bigbluebutton::RoomsController do
|
|
465
448
|
mocked_api.should_receive(:join_meeting_url).
|
466
449
|
with(anything, anything, room.attendee_password).
|
467
450
|
and_return("http://test.com/attendee/join")
|
468
|
-
post :auth, :
|
451
|
+
post :auth, :id => room.to_param, :user => hash
|
469
452
|
should respond_with(:redirect)
|
470
453
|
should redirect_to("http://test.com/attendee/join")
|
471
454
|
end
|
472
455
|
|
473
456
|
context "validates user input and shows error" do
|
474
457
|
before { controller.should_receive(:bigbluebutton_role).once { :password } }
|
475
|
-
before(:each) { post :auth, :
|
458
|
+
before(:each) { post :auth, :id => room.to_param, :user => user_hash }
|
476
459
|
|
477
460
|
context "when name is not set" do
|
478
461
|
let(:user_hash) { { :password => room.moderator_password } }
|
@@ -504,41 +487,57 @@ describe Bigbluebutton::RoomsController do
|
|
504
487
|
context "calling .join_internal" do
|
505
488
|
let(:template) { :invite }
|
506
489
|
let(:hash) { { :name => user.name, :password => room.attendee_password } }
|
507
|
-
let(:request) { post :auth, :
|
490
|
+
let(:request) { post :auth, :id => room.to_param, :user => hash }
|
508
491
|
before { controller.stub(:bigbluebutton_user).and_return(nil) }
|
509
492
|
it_should_behave_like "internal join caller"
|
510
493
|
end
|
511
494
|
end
|
512
495
|
|
513
496
|
describe "#external" do
|
514
|
-
|
515
|
-
let(:
|
497
|
+
let(:server) { Factory.create(:bigbluebutton_server) }
|
498
|
+
let(:meetingid) { 'my-meeting-id' }
|
516
499
|
|
517
500
|
context "on success" do
|
518
|
-
before {
|
519
|
-
|
520
|
-
|
501
|
+
before {
|
502
|
+
controller.stub(:bigbluebutton_user).and_return(nil)
|
503
|
+
BigbluebuttonServer.stub(:find).and_return(server)
|
504
|
+
}
|
505
|
+
before(:each) { get :external, :meeting => meetingid, :server_id => server.id }
|
521
506
|
it { should respond_with(:success) }
|
522
507
|
it { should render_template(:external) }
|
508
|
+
it { should assign_to(:server).with(server) }
|
523
509
|
it { should assign_to(:room).with_kind_of(BigbluebuttonRoom) }
|
524
|
-
it { assigns(:room).meetingid.should be(
|
510
|
+
it { assigns(:room).meetingid.should be(meetingid) }
|
511
|
+
it { assigns(:room).server_id.should be(server.id) }
|
525
512
|
end
|
526
513
|
|
527
514
|
context "when params[:meeting].blank?" do
|
528
|
-
before { controller.stub(:bigbluebutton_user).and_return(nil) }
|
529
|
-
|
530
515
|
context "without params[:redir_url]" do
|
531
|
-
before(:each) { get :external, :server_id =>
|
516
|
+
before(:each) { get :external, :server_id => server.id }
|
532
517
|
it { should respond_with(:redirect) }
|
533
|
-
it { should redirect_to
|
518
|
+
it { should redirect_to bigbluebutton_rooms_path }
|
534
519
|
it { should set_the_flash.to(I18n.t('bigbluebutton_rails.rooms.errors.external.blank_meetingid')) }
|
535
520
|
end
|
536
521
|
|
537
522
|
context "with params[:redir_url]" do
|
538
|
-
before(:each) { get :external, :server_id =>
|
523
|
+
before(:each) { get :external, :server_id => server.id, :redir_url => '/'}
|
539
524
|
it { should redirect_to '/' }
|
540
525
|
end
|
541
526
|
end
|
527
|
+
|
528
|
+
context "when params[:server_id]" do
|
529
|
+
it "is blank" do
|
530
|
+
lambda {
|
531
|
+
get :external, :meeting => meetingid
|
532
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
533
|
+
end
|
534
|
+
|
535
|
+
it "is invalid" do
|
536
|
+
lambda {
|
537
|
+
get :external, :meeting => meetingid, :server_id => server.id + 10
|
538
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
539
|
+
end
|
540
|
+
end
|
542
541
|
end # #external
|
543
542
|
|
544
543
|
describe "#external_auth" do
|
@@ -549,27 +548,36 @@ describe Bigbluebutton::RoomsController do
|
|
549
548
|
:moderator_password => Forgery(:basic).password,
|
550
549
|
:server => mocked_server) }
|
551
550
|
let(:meetings) { [ new_room ] }
|
552
|
-
|
553
|
-
before {
|
554
|
-
mock_server_and_api
|
555
|
-
controller.stub(:bigbluebutton_user).and_return(nil)
|
556
|
-
request.env["HTTP_REFERER"] = http_referer
|
557
|
-
}
|
551
|
+
before { controller.stub(:bigbluebutton_user).and_return(nil) }
|
558
552
|
|
559
|
-
context "assigns @room" do
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
553
|
+
context "assigns @server and @room if params[:meeting] and params[:user] and params[:server_id]" do
|
554
|
+
before {
|
555
|
+
mock_server_and_api
|
556
|
+
mocked_server.should_receive(:fetch_meetings)
|
557
|
+
mocked_server.should_receive(:meetings).and_return(meetings)
|
558
|
+
new_room.should_receive(:perform_join)
|
559
|
+
}
|
560
|
+
before(:each) { post :external_auth, :meeting => new_room.meetingid, :server_id => mocked_server.id, :user => user_hash }
|
561
|
+
it { should assign_to(:room).with(new_room) }
|
562
|
+
it { should assign_to(:server).with(mocked_server) }
|
563
|
+
end
|
564
|
+
|
565
|
+
it "shows error when params[:server_id] is invalid" do
|
566
|
+
lambda {
|
567
|
+
post :external_auth, :meeting => new_room.meetingid, :server_id => nil, :user => user_hash
|
568
|
+
}.should raise_error(ActiveRecord::RecordNotFound)
|
569
|
+
end
|
570
|
+
|
571
|
+
context "shows error" do
|
572
|
+
let(:http_referer) { bigbluebutton_server_path(mocked_server) }
|
573
|
+
before {
|
574
|
+
mock_server_and_api
|
575
|
+
request.env["HTTP_REFERER"] = http_referer
|
576
|
+
}
|
569
577
|
|
570
578
|
context "if not params[:meeting]" do
|
571
|
-
let(:message) { I18n.t('bigbluebutton_rails.rooms.errors.
|
572
|
-
before(:each) { post :external_auth, :
|
579
|
+
let(:message) { I18n.t('bigbluebutton_rails.rooms.errors.external.wrong_params') }
|
580
|
+
before(:each) { post :external_auth, :meeting => nil, :server_id => mocked_server.id, :user => user_hash }
|
573
581
|
it { should assign_to(:room).with(nil) }
|
574
582
|
it { should respond_with(:redirect) }
|
575
583
|
it { should redirect_to(http_referer) }
|
@@ -577,8 +585,8 @@ describe Bigbluebutton::RoomsController do
|
|
577
585
|
end
|
578
586
|
|
579
587
|
context "if not params[:user]" do
|
580
|
-
let(:message) { I18n.t('bigbluebutton_rails.rooms.errors.
|
581
|
-
before(:each) { post :external_auth, :
|
588
|
+
let(:message) { I18n.t('bigbluebutton_rails.rooms.errors.external.wrong_params') }
|
589
|
+
before(:each) { post :external_auth, :meeting => new_room.meetingid, :server_id => mocked_server.id, :user => nil }
|
582
590
|
it { should assign_to(:room).with(nil) }
|
583
591
|
it { should respond_with(:redirect) }
|
584
592
|
it { should redirect_to(http_referer) }
|
@@ -586,8 +594,9 @@ describe Bigbluebutton::RoomsController do
|
|
586
594
|
end
|
587
595
|
end
|
588
596
|
|
589
|
-
context "
|
597
|
+
context "with @server and @room assigned" do
|
590
598
|
before {
|
599
|
+
mock_server_and_api
|
591
600
|
mocked_server.should_receive(:fetch_meetings)
|
592
601
|
mocked_server.should_receive(:meetings).and_return(meetings)
|
593
602
|
}
|
@@ -595,12 +604,12 @@ describe Bigbluebutton::RoomsController do
|
|
595
604
|
it "block access if bigbluebutton_role returns nil" do
|
596
605
|
controller.stub(:bigbluebutton_role) { nil }
|
597
606
|
lambda {
|
598
|
-
post :external_auth, :
|
607
|
+
post :external_auth, :meeting => new_room.meetingid, :server_id => mocked_server.id, :user => user_hash
|
599
608
|
}.should raise_error(BigbluebuttonRails::RoomAccessDenied)
|
600
609
|
end
|
601
610
|
|
602
611
|
context "validates user input and shows error" do
|
603
|
-
before(:each) { post :external_auth, :
|
612
|
+
before(:each) { post :external_auth, :meeting => new_room.meetingid, :server_id => mocked_server.id, :user => user_hash }
|
604
613
|
|
605
614
|
context "when name is not set" do
|
606
615
|
let(:user_hash) { { :password => room.moderator_password } }
|
@@ -633,7 +642,7 @@ describe Bigbluebutton::RoomsController do
|
|
633
642
|
new_room.should_receive(:perform_join).with(anything, :attendee, request).
|
634
643
|
and_return("http://test.com/attendee/join")
|
635
644
|
}
|
636
|
-
before(:each) { post :external_auth, :
|
645
|
+
before(:each) { post :external_auth, :meeting => new_room.meetingid, :server_id => mocked_server.id, :user => user_hash }
|
637
646
|
it { should respond_with(:redirect) }
|
638
647
|
it { should redirect_to("http://test.com/attendee/join") }
|
639
648
|
end
|
@@ -642,7 +651,7 @@ describe Bigbluebutton::RoomsController do
|
|
642
651
|
before {
|
643
652
|
new_room.should_receive(:perform_join).with(user_hash[:name], :attendee, request).and_return(nil)
|
644
653
|
}
|
645
|
-
before(:each) { post :external_auth, :
|
654
|
+
before(:each) { post :external_auth, :meeting => new_room.meetingid, :server_id => mocked_server.id, :user => user_hash }
|
646
655
|
it { should respond_with(:success) }
|
647
656
|
it { should render_template(:external) }
|
648
657
|
it { should set_the_flash.to(I18n.t('bigbluebutton_rails.rooms.errors.auth.not_running')) }
|
@@ -654,22 +663,12 @@ describe Bigbluebutton::RoomsController do
|
|
654
663
|
controller.stub(:bigbluebutton_user).and_return(user)
|
655
664
|
new_room.should_receive(:perform_join).with(user.name, anything, anything). # here's the validation
|
656
665
|
and_return("http://test.com/attendee/join")
|
657
|
-
post :external_auth, :
|
666
|
+
post :external_auth, :meeting => new_room.meetingid, :server_id => mocked_server.id, :user => user_hash
|
658
667
|
end
|
659
668
|
|
660
669
|
end
|
661
670
|
|
662
671
|
end # #external_auth
|
663
672
|
|
664
|
-
# can be used when matching rooms inside some resource other than servers
|
665
|
-
context "selects the first server when the server_id is not defined in the url" do
|
666
|
-
let(:server2) { Factory.create(:bigbluebutton_server) }
|
667
|
-
|
668
|
-
# get /users/:user_id/room/:id(.:format)
|
669
|
-
before(:each) { get :show, :id => room.to_param, :user_id => "1" }
|
670
|
-
it { should respond_with(:success) }
|
671
|
-
it { should assign_to(:server).with(server) }
|
672
|
-
end
|
673
|
-
|
674
673
|
end
|
675
674
|
|