bigbluebutton_rails 0.0.5 → 0.0.6
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/.gitignore +2 -0
- data/.rvmrc +6 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.rdoc +9 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +85 -65
- data/README.rdoc +23 -0
- data/Rakefile +17 -6
- data/app/controllers/bigbluebutton/rooms_controller.rb +79 -58
- data/app/controllers/bigbluebutton/servers_controller.rb +41 -24
- data/app/models/bigbluebutton_room.rb +45 -5
- data/app/models/bigbluebutton_server.rb +5 -7
- data/app/views/bigbluebutton/rooms/external.html.erb +24 -0
- data/app/views/bigbluebutton/rooms/join_mobile.html.erb +1 -1
- data/app/views/bigbluebutton/servers/_activity_list.html.erb +7 -7
- data/app/views/bigbluebutton/servers/activity.html.erb +1 -1
- data/bigbluebutton_rails.gemspec +2 -12
- data/config/locales/en.yml +3 -0
- data/lib/bigbluebutton_rails/rails/routes.rb +12 -6
- data/lib/bigbluebutton_rails/utils.rb +8 -0
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/lib/bigbluebutton_rails.rb +1 -0
- data/spec/bigbluebutton_rails_spec.rb +13 -0
- data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +114 -0
- data/spec/controllers/bigbluebutton/rooms_controller_json_responses_spec.rb +167 -0
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +213 -457
- data/spec/controllers/bigbluebutton/servers_controller_json_responses_spec.rb +148 -0
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +50 -76
- data/spec/factories/bigbluebutton_room.rb +1 -0
- data/spec/models/bigbluebutton_room_spec.rb +141 -17
- data/spec/models/bigbluebutton_server_spec.rb +27 -36
- data/spec/rails_app/app/controllers/application_controller.rb +4 -3
- data/spec/rails_app/config/initializers/rack_hotfix.rb +13 -0
- data/spec/rails_app/features/join_external_bigbluebutton_rooms.feature +19 -0
- data/spec/rails_app/features/manage_bigbluebutton_rooms.feature +3 -3
- data/spec/rails_app/features/manage_bigbluebutton_servers.feature +2 -2
- data/spec/rails_app/features/step_definitions/bigbluebutton_room_steps.rb +29 -3
- data/spec/rails_app/features/step_definitions/bigbluebutton_server_steps.rb +2 -7
- data/spec/rails_app/features/step_definitions/common_steps.rb +15 -2
- data/spec/rails_app/features/step_definitions/web_steps.rb +7 -3
- data/spec/rails_app/features/support/application_controller.rb +12 -0
- data/spec/rails_app/features/support/content.rb +10 -0
- data/spec/rails_app/features/support/env.rb +4 -4
- data/spec/rails_app/features/support/env_gem.rb +2 -1
- data/spec/rails_app/features/support/forms.rb +12 -0
- data/spec/rails_app/features/support/paths.rb +17 -8
- data/spec/rails_app/features/support/selectors.rb +57 -0
- data/spec/rails_app/features/support/within.rb +7 -0
- data/spec/routing/bigbluebutton/rooms_routing_spec.rb +60 -52
- data/spec/routing/bigbluebutton/servers_routing_spec.rb +8 -8
- data/spec/spec_helper.rb +5 -0
- data/spec/support/controllers/bigbluebutton/rooms_controller.rb +7 -0
- data/spec/support/matchers/shoulda/be_boolean.rb +1 -1
- data/spec/support/shared_examples/rooms_controller.rb +37 -0
- metadata +24 -110
- data/spec/rails_app/app/helpers/application_helper.rb +0 -2
@@ -0,0 +1,148 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Bigbluebutton::ServersController do
|
4
|
+
render_views
|
5
|
+
let(:server) { Factory.create(:bigbluebutton_server) }
|
6
|
+
|
7
|
+
context "json responses for " do
|
8
|
+
|
9
|
+
describe "#index" do
|
10
|
+
before do
|
11
|
+
@server1 = Factory.create(:bigbluebutton_server)
|
12
|
+
@server2 = Factory.create(:bigbluebutton_server)
|
13
|
+
end
|
14
|
+
before(:each) { get :index, :format => 'json' }
|
15
|
+
it { should respond_with(:success) }
|
16
|
+
it { should respond_with_content_type(:json) }
|
17
|
+
it { should respond_with_json([@server1, @server2].to_json) }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#new" do
|
21
|
+
before(:each) { get :new, :format => 'json' }
|
22
|
+
it { should respond_with(:success) }
|
23
|
+
it { should respond_with_content_type(:json) }
|
24
|
+
it { should respond_with_json(BigbluebuttonServer.new.to_json).ignoring_values }
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "#show" do
|
28
|
+
before(:each) { get :show, :id => server.to_param, :format => 'json' }
|
29
|
+
it { should respond_with(:success) }
|
30
|
+
it { should respond_with_content_type(:json) }
|
31
|
+
it { should respond_with_json(server.to_json) }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "#create" do
|
35
|
+
let(:new_server) { Factory.build(:bigbluebutton_server) }
|
36
|
+
|
37
|
+
context "on success" do
|
38
|
+
before(:each) {
|
39
|
+
post :create, :bigbluebutton_server => new_server.attributes, :format => 'json'
|
40
|
+
}
|
41
|
+
it { should respond_with(:created) }
|
42
|
+
it { should respond_with_content_type(:json) }
|
43
|
+
it { should respond_with_json(new_server.to_json).ignoring_attributes }
|
44
|
+
end
|
45
|
+
|
46
|
+
context "on failure" do
|
47
|
+
before(:each) {
|
48
|
+
new_server.url = nil # invalid
|
49
|
+
post :create, :bigbluebutton_server => new_server.attributes, :format => 'json'
|
50
|
+
}
|
51
|
+
it { should respond_with(:unprocessable_entity) }
|
52
|
+
it { should respond_with_content_type(:json) }
|
53
|
+
it {
|
54
|
+
new_server.save # should fail
|
55
|
+
should respond_with_json(new_server.errors.full_messages.to_json)
|
56
|
+
}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "#update" do
|
61
|
+
let(:new_server) { Factory.build(:bigbluebutton_server) }
|
62
|
+
before { @server = server }
|
63
|
+
|
64
|
+
context "on success" do
|
65
|
+
before(:each) {
|
66
|
+
put :update, :id => @server.to_param, :bigbluebutton_server => new_server.attributes, :format => 'json'
|
67
|
+
}
|
68
|
+
it { should respond_with(:success) }
|
69
|
+
it { should respond_with_content_type(:json) }
|
70
|
+
end
|
71
|
+
|
72
|
+
context "on failure" do
|
73
|
+
before(:each) {
|
74
|
+
new_server.url = nil # invalid
|
75
|
+
put :update, :id => @server.to_param, :bigbluebutton_server => new_server.attributes, :format => 'json'
|
76
|
+
}
|
77
|
+
it { should respond_with(:unprocessable_entity) }
|
78
|
+
it { should respond_with_content_type(:json) }
|
79
|
+
it {
|
80
|
+
new_server.save # should fail
|
81
|
+
should respond_with_json(new_server.errors.full_messages.to_json)
|
82
|
+
}
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
describe "#destroy" do
|
87
|
+
before :each do
|
88
|
+
@server = server
|
89
|
+
delete :destroy, :id => @server.to_param, :format => 'json'
|
90
|
+
end
|
91
|
+
it { should respond_with(:success) }
|
92
|
+
it { should respond_with_content_type(:json) }
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "#activity" do
|
96
|
+
let(:room1) { Factory.create(:bigbluebutton_room, :server => server) }
|
97
|
+
let(:room2) { Factory.create(:bigbluebutton_room, :server => server) }
|
98
|
+
before do
|
99
|
+
# so we return our mocked server
|
100
|
+
BigbluebuttonServer.stub!(:find_by_param).with(server.to_param).
|
101
|
+
and_return(server)
|
102
|
+
end
|
103
|
+
|
104
|
+
context "on success" do
|
105
|
+
before do
|
106
|
+
server.should_receive(:fetch_meetings).and_return({ })
|
107
|
+
server.should_receive(:meetings).twice.and_return([room1, room2])
|
108
|
+
room1.should_receive(:fetch_meeting_info)
|
109
|
+
room2.should_receive(:fetch_meeting_info)
|
110
|
+
end
|
111
|
+
before(:each) { get :activity, :id => server.to_param, :format => 'json' }
|
112
|
+
it { should respond_with(:success) }
|
113
|
+
it { should respond_with_content_type(:json) }
|
114
|
+
it { should respond_with_json([room1, room2].to_json) }
|
115
|
+
end
|
116
|
+
|
117
|
+
context "on failure" do
|
118
|
+
let(:bbb_error_msg) { "err msg" }
|
119
|
+
let(:bbb_error) { BigBlueButton::BigBlueButtonException.new(bbb_error_msg) }
|
120
|
+
before do
|
121
|
+
server.should_receive(:fetch_meetings).and_return({ })
|
122
|
+
server.should_receive(:meetings).at_least(:once).and_return([room1, room2])
|
123
|
+
room1.should_receive(:fetch_meeting_info) { raise bbb_error }
|
124
|
+
end
|
125
|
+
before(:each) { get :activity, :id => server.to_param, :format => 'json' }
|
126
|
+
it { should respond_with(:error) }
|
127
|
+
it { should respond_with_content_type(:json) }
|
128
|
+
it { should respond_with_json([{ :message => bbb_error_msg }, room1, room2].to_json) }
|
129
|
+
it { should set_the_flash.to(bbb_error_msg) }
|
130
|
+
end
|
131
|
+
|
132
|
+
context "ignores params[:update_list]" do
|
133
|
+
before do
|
134
|
+
server.should_receive(:fetch_meetings).and_return({ })
|
135
|
+
server.should_receive(:meetings).twice.and_return([room1, room2])
|
136
|
+
room1.should_receive(:fetch_meeting_info)
|
137
|
+
room2.should_receive(:fetch_meeting_info)
|
138
|
+
end
|
139
|
+
before(:each) { get :activity, :id => server.to_param, :update_list => true, :format => 'json' }
|
140
|
+
it { should respond_with(:success) }
|
141
|
+
it { should respond_with_content_type(:json) }
|
142
|
+
it { should respond_with_json([room1, room2].to_json) }
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
end
|
148
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Bigbluebutton::ServersController do
|
4
|
-
|
5
4
|
render_views
|
6
5
|
let(:server) { Factory.create(:bigbluebutton_server) }
|
7
6
|
|
@@ -9,24 +8,28 @@ describe Bigbluebutton::ServersController do
|
|
9
8
|
before(:each) { get :index }
|
10
9
|
it { should respond_with(:success) }
|
11
10
|
it { should assign_to(:servers).with(BigbluebuttonServer.all) }
|
11
|
+
it { should render_template(:index) }
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "#show" do
|
15
15
|
before(:each) { get :show, :id => server.to_param }
|
16
16
|
it { should respond_with(:success) }
|
17
17
|
it { should assign_to(:server).with(server) }
|
18
|
+
it { should render_template(:show) }
|
18
19
|
end
|
19
20
|
|
20
21
|
describe "#new" do
|
21
22
|
before(:each) { get :new }
|
22
23
|
it { should respond_with(:success) }
|
23
24
|
it { should assign_to(:server).with_kind_of(BigbluebuttonServer) }
|
25
|
+
it { should render_template(:new) }
|
24
26
|
end
|
25
27
|
|
26
28
|
describe "#edit" do
|
27
29
|
before(:each) { get :edit, :id => server.to_param }
|
28
30
|
it { should respond_with(:success) }
|
29
31
|
it { should assign_to(:server).with(server) }
|
32
|
+
it { should render_template(:edit) }
|
30
33
|
end
|
31
34
|
|
32
35
|
describe "#create" do
|
@@ -75,96 +78,67 @@ describe Bigbluebutton::ServersController do
|
|
75
78
|
}
|
76
79
|
end
|
77
80
|
|
78
|
-
#
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
86
|
-
before(:each) { get :index, :format => 'json' }
|
87
|
-
it { should respond_with(:success) }
|
88
|
-
it { should respond_with_content_type(:json) }
|
89
|
-
it { should respond_with_json([@server1, @server2].to_json) }
|
90
|
-
end
|
91
|
-
|
92
|
-
describe "#new" do
|
93
|
-
before(:each) { get :new, :format => 'json' }
|
94
|
-
it { should respond_with(:success) }
|
95
|
-
it { should respond_with_content_type(:json) }
|
96
|
-
it { should respond_with_json(BigbluebuttonServer.new.to_json).ignoring_values }
|
81
|
+
describe "#activity" do
|
82
|
+
let(:room1) { Factory.create(:bigbluebutton_room, :server => server) }
|
83
|
+
let(:room2) { Factory.create(:bigbluebutton_room, :server => server) }
|
84
|
+
before do
|
85
|
+
# so we return our mocked server
|
86
|
+
BigbluebuttonServer.stub!(:find_by_param).with(server.to_param).
|
87
|
+
and_return(server)
|
97
88
|
end
|
98
89
|
|
99
|
-
|
100
|
-
before(:each) { get :show, :id => server.to_param, :format => 'json' }
|
101
|
-
it { should respond_with(:success) }
|
102
|
-
it { should respond_with_content_type(:json) }
|
103
|
-
it { should respond_with_json(server.to_json) }
|
104
|
-
end
|
90
|
+
context "standard behaviour" do
|
105
91
|
|
106
|
-
|
107
|
-
|
92
|
+
before do
|
93
|
+
# mock some methods that trigger BBB API calls
|
94
|
+
server.should_receive(:fetch_meetings).and_return({ })
|
95
|
+
server.should_receive(:meetings).at_least(:once).and_return([room1, room2])
|
96
|
+
room1.should_receive(:fetch_meeting_info)
|
97
|
+
room2.should_receive(:fetch_meeting_info)
|
98
|
+
end
|
108
99
|
|
109
|
-
context
|
110
|
-
before(:each) {
|
111
|
-
|
112
|
-
}
|
113
|
-
it { should
|
114
|
-
it { should respond_with_content_type(:json) }
|
115
|
-
it { should respond_with_json(new_server.to_json).ignoring_attributes }
|
100
|
+
context do
|
101
|
+
before(:each) { get :activity, :id => server.to_param }
|
102
|
+
it { should respond_with(:success) }
|
103
|
+
it { should assign_to(:server).with(server) }
|
104
|
+
it { should render_template(:activity) }
|
116
105
|
end
|
117
106
|
|
118
|
-
context "
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
should respond_with_json(new_server.errors.full_messages.to_json)
|
128
|
-
}
|
107
|
+
context "with params[:update_list]" do
|
108
|
+
context "and :format nil" do
|
109
|
+
before(:each) { get :activity, :id => server.to_param, :update_list => true }
|
110
|
+
it { should render_template(:activity_list) }
|
111
|
+
end
|
112
|
+
context "and :format = 'html'" do
|
113
|
+
before(:each) { get :activity, :id => server.to_param, :update_list => true, :format => "html" }
|
114
|
+
it { should render_template(:activity_list) }
|
115
|
+
end
|
129
116
|
end
|
117
|
+
|
130
118
|
end
|
131
119
|
|
132
|
-
|
133
|
-
let(:
|
134
|
-
|
120
|
+
context "exception handling" do
|
121
|
+
let(:bbb_error_msg) { "err msg" }
|
122
|
+
let(:bbb_error) { BigBlueButton::BigBlueButtonException.new(bbb_error_msg) }
|
135
123
|
|
136
|
-
context "
|
137
|
-
before(:
|
138
|
-
|
139
|
-
}
|
140
|
-
it { should respond_with(:success) }
|
141
|
-
it { should respond_with_content_type(:json) }
|
124
|
+
context "at fetch_meetings" do
|
125
|
+
before { server.should_receive(:fetch_meetings) { raise bbb_error } }
|
126
|
+
before(:each) { get :activity, :id => server.to_param }
|
127
|
+
it { should set_the_flash.to(bbb_error_msg) }
|
142
128
|
end
|
143
129
|
|
144
|
-
context "
|
145
|
-
before
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
it {
|
152
|
-
new_server.save # should fail
|
153
|
-
should respond_with_json(new_server.errors.full_messages.to_json)
|
154
|
-
}
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
describe "#destroy" do
|
159
|
-
before :each do
|
160
|
-
@server = server
|
161
|
-
delete :destroy, :id => @server.to_param, :format => 'json'
|
130
|
+
context "at fetch_meeting_info" do
|
131
|
+
before do
|
132
|
+
server.should_receive(:fetch_meetings).and_return({ })
|
133
|
+
server.should_receive(:meetings).at_least(:once).and_return([room1, room2])
|
134
|
+
room1.should_receive(:fetch_meeting_info) { raise bbb_error }
|
135
|
+
end
|
136
|
+
before(:each) { get :activity, :id => server.to_param }
|
137
|
+
it { should set_the_flash.to(bbb_error_msg) }
|
162
138
|
end
|
163
|
-
it { should respond_with(:success) }
|
164
|
-
it { should respond_with_content_type(:json) }
|
165
139
|
end
|
166
140
|
|
167
|
-
end #
|
141
|
+
end # #activity
|
168
142
|
|
169
143
|
end
|
170
144
|
|
@@ -163,13 +163,21 @@ describe BigbluebuttonRoom do
|
|
163
163
|
end
|
164
164
|
|
165
165
|
context "voice_bridge" do
|
166
|
-
it { room.voice_bridge.should_not be_nil }
|
167
|
-
it { room.voice_bridge.length.should == 5 }
|
168
|
-
it { room.voice_bridge[0].should == '7' }
|
169
166
|
it {
|
170
167
|
b = BigbluebuttonRoom.new(:voice_bridge => "user defined")
|
171
168
|
b.voice_bridge.should == "user defined"
|
172
169
|
}
|
170
|
+
context "with a random value" do
|
171
|
+
it { room.voice_bridge.should_not be_nil }
|
172
|
+
it { room.voice_bridge.should =~ /7[0-9]{4}/ }
|
173
|
+
it "tries to randomize 10 times if voice_bridge already exists" do
|
174
|
+
room = Factory.create(:bigbluebutton_room, :voice_bridge => "70000")
|
175
|
+
BigbluebuttonRoom.stub!(:find_by_voice_bridge).and_return(room)
|
176
|
+
ActiveSupport::SecureRandom.should_receive(:random_number).exactly(10).and_return(0000)
|
177
|
+
room2 = BigbluebuttonRoom.new # triggers the random_number calls
|
178
|
+
room2.voice_bridge.should == "70000"
|
179
|
+
end
|
180
|
+
end
|
173
181
|
end
|
174
182
|
end
|
175
183
|
|
@@ -321,22 +329,39 @@ describe BigbluebuttonRoom do
|
|
321
329
|
|
322
330
|
it { should respond_to(:send_create) }
|
323
331
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
+
context "send create_meeting" do
|
333
|
+
|
334
|
+
context "for a stored room" do
|
335
|
+
before do
|
336
|
+
mocked_api.should_receive(:create_meeting).
|
337
|
+
with(room.name, room.meetingid, room.moderator_password,
|
338
|
+
room.attendee_password, room.welcome_msg, room.dial_number,
|
339
|
+
room.logout_url, room.max_participants, room.voice_bridge).
|
340
|
+
and_return(hash_create)
|
341
|
+
room.server = mocked_server
|
342
|
+
room.send_create
|
343
|
+
end
|
344
|
+
it { room.attendee_password.should be(attendee_password) }
|
345
|
+
it { room.moderator_password.should be(moderator_password) }
|
346
|
+
it { room.changed?.should be_false }
|
347
|
+
end
|
332
348
|
|
333
|
-
|
334
|
-
|
349
|
+
context "for a new_record" do
|
350
|
+
let(:new_room) { Factory.build(:bigbluebutton_room) }
|
351
|
+
before do
|
352
|
+
mocked_api.should_receive(:create_meeting).
|
353
|
+
with(new_room.name, new_room.meetingid, new_room.moderator_password,
|
354
|
+
new_room.attendee_password, new_room.welcome_msg, new_room.dial_number,
|
355
|
+
new_room.logout_url, new_room.max_participants, new_room.voice_bridge).
|
356
|
+
and_return(hash_create)
|
357
|
+
new_room.server = mocked_server
|
358
|
+
new_room.send_create
|
359
|
+
end
|
360
|
+
it { new_room.attendee_password.should be(attendee_password) }
|
361
|
+
it { new_room.moderator_password.should be(moderator_password) }
|
362
|
+
it("do not save the record") { new_room.new_record?.should be_true }
|
363
|
+
end
|
335
364
|
|
336
|
-
# to be sure that the model was saved
|
337
|
-
saved = BigbluebuttonRoom.find(room.id)
|
338
|
-
saved.attendee_password.should == attendee_password
|
339
|
-
saved.moderator_password.should == moderator_password
|
340
365
|
end
|
341
366
|
|
342
367
|
context "randomizes meetingid" do
|
@@ -409,6 +434,13 @@ describe BigbluebuttonRoom do
|
|
409
434
|
room.server = mocked_server
|
410
435
|
room.join_url(username, :attendee)
|
411
436
|
end
|
437
|
+
|
438
|
+
it "without a role" do
|
439
|
+
mocked_api.should_receive(:join_meeting_url).
|
440
|
+
with(room.meetingid, username, 'pass')
|
441
|
+
room.server = mocked_server
|
442
|
+
room.join_url(username, nil, 'pass')
|
443
|
+
end
|
412
444
|
end
|
413
445
|
|
414
446
|
end
|
@@ -427,6 +459,98 @@ describe BigbluebuttonRoom do
|
|
427
459
|
end
|
428
460
|
end
|
429
461
|
|
462
|
+
describe "#add_domain_to_logout_url" do
|
463
|
+
context "when logout_url has a path only" do
|
464
|
+
let(:room) { Factory.create(:bigbluebutton_room, :logout_url => '/only/path') }
|
465
|
+
before(:each) { room.add_domain_to_logout_url("HTTP://", "test.com") }
|
466
|
+
it { room.logout_url.should == "http://test.com/only/path" }
|
467
|
+
end
|
468
|
+
|
469
|
+
context "when logout_url has a path and domain" do
|
470
|
+
let(:room) { Factory.create(:bigbluebutton_room, :logout_url => 'other.com/only/path') }
|
471
|
+
before(:each) { room.add_domain_to_logout_url("HTTP://", "test.com") }
|
472
|
+
it { room.logout_url.should == "http://other.com/only/path" }
|
473
|
+
end
|
474
|
+
|
475
|
+
context "when logout_url has a path, domain and protocol" do
|
476
|
+
let(:room) { Factory.create(:bigbluebutton_room, :logout_url => 'HTTPS://other.com/only/path') }
|
477
|
+
before(:each) { room.add_domain_to_logout_url("HTTP://", "test.com") }
|
478
|
+
it { room.logout_url.should == "https://other.com/only/path" }
|
479
|
+
end
|
480
|
+
|
481
|
+
context "does nothing if logout_url is nil" do
|
482
|
+
let(:room) { Factory.create(:bigbluebutton_room, :logout_url => nil) }
|
483
|
+
before(:each) { room.add_domain_to_logout_url("HTTP://", "test.com") }
|
484
|
+
it { room.logout_url.should == nil }
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
488
|
+
describe "#perform_join" do
|
489
|
+
let(:room) { Factory.create(:bigbluebutton_room) }
|
490
|
+
let(:user) { Factory.build(:user) }
|
491
|
+
|
492
|
+
context "for an attendee" do
|
493
|
+
before { room.should_receive(:fetch_is_running?) }
|
494
|
+
|
495
|
+
context "when the conference is running" do
|
496
|
+
before {
|
497
|
+
room.should_receive(:is_running?).and_return(true)
|
498
|
+
room.should_receive(:join_url).with(user.name, :attendee).
|
499
|
+
and_return("http://test.com/attendee/join")
|
500
|
+
}
|
501
|
+
subject { room.perform_join(user.name, :attendee) }
|
502
|
+
it { should == "http://test.com/attendee/join" }
|
503
|
+
end
|
504
|
+
|
505
|
+
context "when the conference is not running" do
|
506
|
+
before { room.should_receive(:is_running?).and_return(false) }
|
507
|
+
subject { room.perform_join(user.name, :attendee) }
|
508
|
+
it { should be_nil }
|
509
|
+
end
|
510
|
+
end
|
511
|
+
|
512
|
+
context "for a moderator" do
|
513
|
+
before { room.should_receive(:fetch_is_running?) }
|
514
|
+
|
515
|
+
context "when the conference is running" do
|
516
|
+
before {
|
517
|
+
room.should_receive(:is_running?).and_return(true)
|
518
|
+
room.should_receive(:join_url).with(user.name, :moderator).
|
519
|
+
and_return("http://test.com/moderator/join")
|
520
|
+
}
|
521
|
+
subject { room.perform_join(user.name, :moderator) }
|
522
|
+
it { should == "http://test.com/moderator/join" }
|
523
|
+
end
|
524
|
+
|
525
|
+
context "when the conference is not running" do
|
526
|
+
before {
|
527
|
+
room.should_receive(:is_running?).and_return(false)
|
528
|
+
room.should_receive(:send_create)
|
529
|
+
room.should_receive(:join_url).with(user.name, :moderator).
|
530
|
+
and_return("http://test.com/moderator/join")
|
531
|
+
}
|
532
|
+
subject { room.perform_join(user.name, :moderator) }
|
533
|
+
it { should == "http://test.com/moderator/join" }
|
534
|
+
end
|
535
|
+
|
536
|
+
context "when the arg 'request' is informed" do
|
537
|
+
let(:request) { stub(ActionController::Request) }
|
538
|
+
before {
|
539
|
+
request.stub!(:protocol).and_return("HTTP://")
|
540
|
+
request.stub!(:host).and_return("test.com")
|
541
|
+
room.should_receive(:add_domain_to_logout_url).with("HTTP://", "test.com")
|
542
|
+
room.should_receive(:is_running?).and_return(true)
|
543
|
+
room.should_receive(:join_url).with(user.name, :moderator).
|
544
|
+
and_return("http://test.com/moderator/join")
|
545
|
+
}
|
546
|
+
subject { room.perform_join(user.name, :moderator, request) }
|
547
|
+
it { should == "http://test.com/moderator/join" }
|
548
|
+
end
|
549
|
+
|
550
|
+
end
|
551
|
+
|
552
|
+
end
|
553
|
+
|
430
554
|
end
|
431
555
|
|
432
556
|
end
|
@@ -133,8 +133,9 @@ describe BigbluebuttonServer do
|
|
133
133
|
it { server.api.should == api }
|
134
134
|
|
135
135
|
# updating any of these attributes should update the api
|
136
|
+
# FIXME: can't test the version updated bc only 0.7 is supported right now
|
136
137
|
{ :url => 'http://anotherurl.com/bigbluebutton/api',
|
137
|
-
:salt => '12345-abcde-67890-fghijk', :version => '0.
|
138
|
+
:salt => '12345-abcde-67890-fghijk', :version => '0.7' }.each do |k,v|
|
138
139
|
it {
|
139
140
|
server.send("#{k}=", v)
|
140
141
|
server.api.send(k).should == v
|
@@ -151,14 +152,13 @@ describe BigbluebuttonServer do
|
|
151
152
|
end
|
152
153
|
end
|
153
154
|
|
155
|
+
it { should respond_to(:fetch_meetings) }
|
156
|
+
it { should respond_to(:meetings) }
|
157
|
+
|
154
158
|
context "fetching info from bbb" do
|
155
159
|
let(:server) { Factory.create(:bigbluebutton_server) }
|
156
160
|
let(:room1) { Factory.create(:bigbluebutton_room, :server => server, :meetingid => "room1", :randomize_meetingid => true) }
|
157
161
|
let(:room2) { Factory.create(:bigbluebutton_room, :server => server, :meetingid => "room2", :randomize_meetingid => true) }
|
158
|
-
before {
|
159
|
-
@api_mock = mock(BigBlueButton::BigBlueButtonApi)
|
160
|
-
server.stub(:api).and_return(@api_mock)
|
161
|
-
}
|
162
162
|
|
163
163
|
# the hashes should be exactly as returned by bigbluebutton-api-ruby to be sure we are testing it right
|
164
164
|
let(:meetings) {
|
@@ -174,41 +174,32 @@ describe BigbluebuttonServer do
|
|
174
174
|
}
|
175
175
|
}
|
176
176
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
it "fetches meetings" do
|
177
|
+
before {
|
178
|
+
@api_mock = mock(BigBlueButton::BigBlueButtonApi)
|
179
|
+
server.stub(:api).and_return(@api_mock)
|
181
180
|
@api_mock.should_receive(:get_meetings).and_return(hash)
|
182
181
|
server.fetch_meetings
|
183
182
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
server.meetings[0].new_record?.should be_false
|
191
|
-
server.meetings[0].external.should be_false
|
192
|
-
server.meetings[0].randomize_meetingid.should be_true
|
193
|
-
|
194
|
-
server.meetings[1].should == room2
|
195
|
-
server.meetings[1].attendee_password.should == "pass"
|
196
|
-
server.meetings[1].moderator_password.should == "pass"
|
197
|
-
server.meetings[1].running.should == false
|
198
|
-
server.meetings[1].new_record?.should be_false
|
199
|
-
server.meetings[1].external.should be_false
|
200
|
-
server.meetings[1].randomize_meetingid.should be_true
|
201
|
-
|
202
|
-
server.meetings[2].meetingid.should == "im not in the db"
|
203
|
-
server.meetings[2].server.should == server
|
204
|
-
server.meetings[2].attendee_password.should == "pass"
|
205
|
-
server.meetings[2].moderator_password.should == "pass"
|
206
|
-
server.meetings[2].running.should == true
|
207
|
-
server.meetings[2].new_record?.should be_false
|
208
|
-
server.meetings[2].external.should be_true
|
209
|
-
server.meetings[2].randomize_meetingid.should be_false
|
210
|
-
end
|
183
|
+
# the passwords are updated during fetch_meetings
|
184
|
+
room1.moderator_password = "mp"
|
185
|
+
room1.attendee_password = "ap"
|
186
|
+
room2.moderator_password = "pass"
|
187
|
+
room2.attendee_password = "pass"
|
188
|
+
}
|
211
189
|
|
190
|
+
it { server.meetings.count.should be(3) }
|
191
|
+
it { server.meetings[0].should have_same_attributes_as(room1) }
|
192
|
+
it { server.meetings[1].should have_same_attributes_as(room2) }
|
193
|
+
it { server.meetings[2].meetingid.should == "im not in the db" }
|
194
|
+
it { server.meetings[2].name.should == "im not in the db" }
|
195
|
+
it { server.meetings[2].server.should == server }
|
196
|
+
it { server.meetings[2].attendee_password.should == "pass" }
|
197
|
+
it { server.meetings[2].moderator_password.should == "pass" }
|
198
|
+
it { server.meetings[2].running.should == true }
|
199
|
+
it { server.meetings[2].new_record?.should be_true }
|
200
|
+
it { server.meetings[2].external.should be_true }
|
201
|
+
it { server.meetings[2].randomize_meetingid.should be_false }
|
202
|
+
it { server.meetings[2].private.should be_true }
|
212
203
|
end
|
213
204
|
|
214
205
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# FIXME: Temporary monkey-patch to solve rack warnings
|
2
|
+
# See: http://blog.enricostahn.com/warning-regexp-match-n-against-to-utf-8-strin
|
3
|
+
# This is solved in rack 1.3, but rails stills requires rack 1.2
|
4
|
+
module Rack
|
5
|
+
module Utils
|
6
|
+
def escape(s)
|
7
|
+
CGI.escape(s.to_s)
|
8
|
+
end
|
9
|
+
def unescape(s)
|
10
|
+
CGI.unescape(s)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Feature: Join External BigBlueButton Rooms
|
2
|
+
In order to join webconferences that were created from another application
|
3
|
+
One needs to enter his name and a password
|
4
|
+
|
5
|
+
Scenario: Joining an external BigBlueButton room
|
6
|
+
Given a user named "test user"
|
7
|
+
And a server
|
8
|
+
And an external room
|
9
|
+
When the user goes to the join external room page for this room
|
10
|
+
Then he should see a form to join the external room
|
11
|
+
And be able to join the room
|
12
|
+
|
13
|
+
Scenario: Uses the user name as the default to join a room
|
14
|
+
Given a user named "test user"
|
15
|
+
And a server
|
16
|
+
And an external room
|
17
|
+
When the user goes to the join external room page for this room
|
18
|
+
Then he should see a form to join the external room
|
19
|
+
And his name should be in the appropriate input
|