bigbluebutton_rails 2.3.0 → 3.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -2
- data/Gemfile +0 -1
- data/Gemfile.lock +27 -27
- data/Rakefile +15 -14
- data/app/controllers/bigbluebutton/api/rooms_controller.rb +2 -2
- data/app/controllers/bigbluebutton/meetings_controller.rb +69 -0
- data/app/controllers/bigbluebutton/recordings_controller.rb +2 -8
- data/app/controllers/bigbluebutton/rooms_controller.rb +5 -4
- data/app/controllers/bigbluebutton/servers_controller.rb +2 -2
- data/app/models/bigbluebutton_meeting.rb +1 -1
- data/app/models/bigbluebutton_recording.rb +15 -3
- data/app/models/bigbluebutton_room.rb +28 -18
- data/app/models/bigbluebutton_server.rb +9 -9
- data/app/views/bigbluebutton/meetings/_form.html.erb +30 -0
- data/app/views/bigbluebutton/meetings/edit.html.erb +5 -0
- data/app/views/bigbluebutton/recordings/_form.html.erb +0 -4
- data/app/views/bigbluebutton/recordings/_recordings.html.erb +0 -1
- data/app/views/bigbluebutton/recordings/show.html.erb +0 -5
- data/app/views/bigbluebutton/rooms/_form.html.erb +2 -2
- data/app/views/bigbluebutton/rooms/_rooms.html.erb +1 -1
- data/app/views/bigbluebutton/rooms/show.html.erb +2 -2
- data/app/views/bigbluebutton/servers/_form.html.erb +2 -2
- data/app/views/bigbluebutton/servers/index.html.erb +1 -1
- data/app/views/bigbluebutton/servers/show.html.erb +2 -2
- data/app/workers/bigbluebutton_recordings_for_room_worker.rb +1 -1
- data/config/locales/en.yml +37 -24
- data/config/locales/pt-br.yml +37 -24
- data/lib/bigbluebutton_rails/configuration.rb +3 -0
- data/lib/bigbluebutton_rails/rails/routes.rb +6 -1
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/lib/generators/bigbluebutton_rails/templates/migration.rb +3 -3
- data/lib/generators/bigbluebutton_rails/templates/migration_2_4_0.rb +18 -0
- data/lib/generators/bigbluebutton_rails/templates/migration_2_5_0.rb +9 -0
- data/spec/controllers/bigbluebutton/api/rooms_controller_spec.rb +3 -3
- data/spec/controllers/bigbluebutton/meetings_controller_spec.rb +199 -0
- data/spec/controllers/bigbluebutton/recordings_controller_spec.rb +3 -3
- data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +4 -2
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +12 -6
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +8 -8
- data/spec/factories/bigbluebutton_meeting.rb +1 -0
- data/spec/factories/bigbluebutton_recording.rb +0 -1
- data/spec/factories/bigbluebutton_room.rb +1 -1
- data/spec/factories/bigbluebutton_server.rb +1 -1
- data/spec/models/bigbluebutton_meeting_db_spec.rb +2 -0
- data/spec/models/bigbluebutton_meeting_spec.rb +1 -1
- data/spec/models/bigbluebutton_recording_db_spec.rb +0 -1
- data/spec/models/bigbluebutton_recording_spec.rb +0 -4
- data/spec/models/bigbluebutton_room_db_spec.rb +1 -1
- data/spec/models/bigbluebutton_room_spec.rb +58 -69
- data/spec/models/bigbluebutton_server_db_spec.rb +1 -1
- data/spec/models/bigbluebutton_server_spec.rb +26 -26
- data/spec/rails_app/features/step_definitions/create_rooms_steps.rb +2 -2
- data/spec/rails_app/features/step_definitions/create_servers_steps.rb +2 -2
- data/spec/rails_app/features/step_definitions/destroy_rooms_steps.rb +1 -1
- data/spec/rails_app/features/step_definitions/destroy_servers_steps.rb +1 -1
- data/spec/rails_app/features/support/templates.rb +10 -10
- data/spec/rails_app/lib/tasks/db/populate.rake +0 -1
- data/spec/routing/bigbluebutton/meetings_routing_spec.rb +14 -0
- data/spec/support/controllers/bigbluebutton/rooms_controller.rb +6 -2
- data/spec/support/mocked_server.rb +2 -2
- metadata +8 -1
@@ -12,7 +12,6 @@ FactoryGirl.define do
|
|
12
12
|
r.sequence(:recordid) { |n| "rec#{n}-#{SecureRandom.uuid}-#{DateTime.now.to_i}" }
|
13
13
|
r.size { rand((20*1024**2)..(500*1024**2)) } # size ranging from 20Mb to 500Mb
|
14
14
|
r.available true
|
15
|
-
r.description { Forgery(:lorem_ipsum).words(10) }
|
16
15
|
|
17
16
|
after(:create) do |r|
|
18
17
|
r.updated_at = r.updated_at.change(:usec => 0)
|
@@ -10,7 +10,7 @@ FactoryGirl.define do
|
|
10
10
|
r.moderator_api_password { SecureRandom.uuid }
|
11
11
|
r.welcome_msg { Forgery(:lorem_ipsum).sentences(2) }
|
12
12
|
r.private false
|
13
|
-
r.sequence(:
|
13
|
+
r.sequence(:slug) { |n| "meeting-#{n}" }
|
14
14
|
r.external false
|
15
15
|
r.record_meeting false
|
16
16
|
r.duration 0
|
@@ -4,7 +4,7 @@ FactoryGirl.define do
|
|
4
4
|
s.sequence(:url) { |n| "http://bigbluebutton#{n}.test.com/bigbluebutton/api" }
|
5
5
|
s.secret { Forgery(:basic).password :at_least => 30, :at_most => 40 }
|
6
6
|
s.version '0.9'
|
7
|
-
s.sequence(:
|
7
|
+
s.sequence(:slug) { |n| "server-#{n}" }
|
8
8
|
end
|
9
9
|
|
10
10
|
after(:create) do |s|
|
@@ -16,6 +16,8 @@ describe BigbluebuttonMeeting do
|
|
16
16
|
it { should have_db_column(:ended).of_type(:boolean) }
|
17
17
|
it { should have_db_column(:server_url).of_type(:string) }
|
18
18
|
it { should have_db_column(:server_secret).of_type(:string) }
|
19
|
+
it { should have_db_column(:title).of_type(:string) }
|
20
|
+
|
19
21
|
it "default values" do
|
20
22
|
room = BigbluebuttonMeeting.new
|
21
23
|
room.running.should be(false)
|
@@ -11,7 +11,7 @@ describe BigbluebuttonMeeting do
|
|
11
11
|
it { should belong_to(:room) }
|
12
12
|
it { should validate_presence_of(:room) }
|
13
13
|
|
14
|
-
it { should have_one(:recording).dependent(:
|
14
|
+
it { should have_one(:recording).dependent(:destroy) }
|
15
15
|
|
16
16
|
it { should validate_presence_of(:meetingid) }
|
17
17
|
it { should ensure_length_of(:meetingid).is_at_least(1).is_at_most(100) }
|
@@ -13,7 +13,6 @@ describe BigbluebuttonRecording do
|
|
13
13
|
it { should have_db_column(:start_time).of_type(:integer) }
|
14
14
|
it { should have_db_column(:end_time).of_type(:integer) }
|
15
15
|
it { should have_db_column(:available).of_type(:boolean) }
|
16
|
-
it { should have_db_column(:description).of_type(:string) }
|
17
16
|
it { should have_db_column(:created_at).of_type(:datetime) }
|
18
17
|
it { should have_db_column(:updated_at).of_type(:datetime) }
|
19
18
|
it { should have_db_column(:size).of_type(:integer) }
|
@@ -665,10 +665,6 @@ describe BigbluebuttonRecording do
|
|
665
665
|
it("sets server") { @recording.server.should == new_server }
|
666
666
|
it("sets room") { @recording.room.should == @room }
|
667
667
|
it("sets meeting") { @recording.meeting.should == @meeting }
|
668
|
-
it("sets description") {
|
669
|
-
time = Time.at(data[:start_time]).utc.to_formatted_s(:long)
|
670
|
-
@recording.description.should == I18n.t('bigbluebutton_rails.recordings.default.description', :time => time)
|
671
|
-
}
|
672
668
|
it("sets recording_users") { @recording.recording_users.should eql([3, 4]) }
|
673
669
|
end
|
674
670
|
|
@@ -19,7 +19,7 @@ describe BigbluebuttonRoom do
|
|
19
19
|
it { should have_db_column(:max_participants).of_type(:integer) }
|
20
20
|
it { should have_db_column(:private).of_type(:boolean) }
|
21
21
|
it { should have_db_column(:external).of_type(:boolean) }
|
22
|
-
it { should have_db_column(:
|
22
|
+
it { should have_db_column(:slug).of_type(:string) }
|
23
23
|
it { should have_db_column(:record_meeting).of_type(:boolean) }
|
24
24
|
it { should have_db_column(:duration).of_type(:integer) }
|
25
25
|
it { should have_db_column(:created_at).of_type(:datetime) }
|
@@ -40,9 +40,9 @@ describe BigbluebuttonRoom do
|
|
40
40
|
it { should validate_presence_of(:name) }
|
41
41
|
it { should ensure_length_of(:name).is_at_least(1).is_at_most(250) }
|
42
42
|
|
43
|
-
it { should validate_presence_of(:
|
44
|
-
it { should validate_uniqueness_of(:
|
45
|
-
it { should ensure_length_of(:
|
43
|
+
it { should validate_presence_of(:slug) }
|
44
|
+
it { should validate_uniqueness_of(:slug) }
|
45
|
+
it { should ensure_length_of(:slug).is_at_least(1) }
|
46
46
|
|
47
47
|
it { should be_boolean(:private) }
|
48
48
|
|
@@ -74,7 +74,7 @@ describe BigbluebuttonRoom do
|
|
74
74
|
it { should respond_to(:to_param) }
|
75
75
|
it {
|
76
76
|
r = FactoryGirl.create(:bigbluebutton_room)
|
77
|
-
r.to_param.should be(r.
|
77
|
+
r.to_param.should be(r.slug)
|
78
78
|
}
|
79
79
|
end
|
80
80
|
|
@@ -110,9 +110,9 @@ describe BigbluebuttonRoom do
|
|
110
110
|
describe ".search_by_terms" do
|
111
111
|
let!(:rooms) {
|
112
112
|
[
|
113
|
-
FactoryGirl.create(:bigbluebutton_room, name: "La Lo",
|
114
|
-
FactoryGirl.create(:bigbluebutton_room, name: "La Le",
|
115
|
-
FactoryGirl.create(:bigbluebutton_room, name: "Li Lo",
|
113
|
+
FactoryGirl.create(:bigbluebutton_room, name: "La Lo", slug: "lalo-1"),
|
114
|
+
FactoryGirl.create(:bigbluebutton_room, name: "La Le", slug: "lale-2"),
|
115
|
+
FactoryGirl.create(:bigbluebutton_room, name: "Li Lo", slug: "lilo")
|
116
116
|
]
|
117
117
|
}
|
118
118
|
let(:subject) { BigbluebuttonRoom.search_by_terms(terms) }
|
@@ -155,7 +155,7 @@ describe BigbluebuttonRoom do
|
|
155
155
|
let(:terms) { ['abcdef'] }
|
156
156
|
before {
|
157
157
|
rooms[1].update_attributes(name: 'abcdef')
|
158
|
-
rooms[2].update_attributes(
|
158
|
+
rooms[2].update_attributes(slug: 'abcdef')
|
159
159
|
}
|
160
160
|
it { subject.count.should be(2) }
|
161
161
|
it { subject.should include(rooms[1], rooms[2]) }
|
@@ -277,40 +277,38 @@ describe BigbluebuttonRoom do
|
|
277
277
|
end
|
278
278
|
end
|
279
279
|
|
280
|
-
context "#
|
281
|
-
let(:msg) { I18n.t('bigbluebutton_rails.rooms.errors.
|
282
|
-
it { should_not allow_value("123 321").for(:
|
283
|
-
it { should_not allow_value("").for(:
|
284
|
-
it { should_not allow_value("ab@c").for(:
|
285
|
-
it { should_not allow_value("ab#c").for(:
|
286
|
-
it { should_not allow_value("ab$c").for(:
|
287
|
-
it { should_not allow_value("ab%c").for(:
|
288
|
-
it { should_not allow_value("ábcd").for(:
|
289
|
-
it { should_not allow_value("-abc").for(:
|
290
|
-
it { should_not allow_value("abc-").for(:
|
291
|
-
it { should_not allow_value("-").for(:
|
292
|
-
it { should allow_value("_abc").for(:
|
293
|
-
it { should allow_value("abc_").for(:
|
294
|
-
it { should allow_value("abc").for(:
|
295
|
-
it { should allow_value("123").for(:
|
296
|
-
it { should allow_value("1").for(:
|
297
|
-
it { should allow_value("a").for(:
|
298
|
-
it { should allow_value("_").for(:
|
299
|
-
it { should allow_value("abc-123_d5").for(:
|
280
|
+
context "#slug format" do
|
281
|
+
let(:msg) { I18n.t('bigbluebutton_rails.rooms.errors.slug_format') }
|
282
|
+
it { should_not allow_value("123 321").for(:slug).with_message(msg) }
|
283
|
+
it { should_not allow_value("").for(:slug).with_message(msg) }
|
284
|
+
it { should_not allow_value("ab@c").for(:slug).with_message(msg) }
|
285
|
+
it { should_not allow_value("ab#c").for(:slug).with_message(msg) }
|
286
|
+
it { should_not allow_value("ab$c").for(:slug).with_message(msg) }
|
287
|
+
it { should_not allow_value("ab%c").for(:slug).with_message(msg) }
|
288
|
+
it { should_not allow_value("ábcd").for(:slug).with_message(msg) }
|
289
|
+
it { should_not allow_value("-abc").for(:slug).with_message(msg) }
|
290
|
+
it { should_not allow_value("abc-").for(:slug).with_message(msg) }
|
291
|
+
it { should_not allow_value("-").for(:slug).with_message(msg) }
|
292
|
+
it { should allow_value("_abc").for(:slug).with_message(msg) }
|
293
|
+
it { should allow_value("abc_").for(:slug).with_message(msg) }
|
294
|
+
it { should allow_value("abc").for(:slug).with_message(msg) }
|
295
|
+
it { should allow_value("123").for(:slug).with_message(msg) }
|
296
|
+
it { should allow_value("1").for(:slug).with_message(msg) }
|
297
|
+
it { should allow_value("a").for(:slug).with_message(msg) }
|
298
|
+
it { should allow_value("_").for(:slug).with_message(msg) }
|
299
|
+
it { should allow_value("abc-123_d5").for(:slug).with_message(msg) }
|
300
300
|
end
|
301
301
|
|
302
|
-
context "sets
|
302
|
+
context "sets slug as the downcased parameterized name if slug is" do
|
303
303
|
after :each do
|
304
304
|
@room.save.should be_truthy
|
305
|
-
@room.
|
305
|
+
@room.slug.should == @room.name.downcase.parameterize
|
306
306
|
end
|
307
307
|
it "nil" do
|
308
|
-
@room = FactoryGirl.build(:bigbluebutton_room, :
|
309
|
-
:name => "-My Name@ _Is Odd_-")
|
308
|
+
@room = FactoryGirl.build(:bigbluebutton_room, slug: nil, name: "-My Name@ _Is Odd_-")
|
310
309
|
end
|
311
310
|
it "empty" do
|
312
|
-
@room = FactoryGirl.build(:bigbluebutton_room, :
|
313
|
-
:name => "-My Name@ _Is Odd_-")
|
311
|
+
@room = FactoryGirl.build(:bigbluebutton_room, slug: "", name: "-My Name@ _Is Odd_-")
|
314
312
|
end
|
315
313
|
end
|
316
314
|
|
@@ -643,6 +641,7 @@ describe BigbluebuttonRoom do
|
|
643
641
|
let(:user) { FactoryGirl.build(:user) }
|
644
642
|
before do
|
645
643
|
params = get_create_params(room, user)
|
644
|
+
# BigbluebuttonRails.configuration.should_receive(:get_create_options).and_return(Proc.new{ params })
|
646
645
|
mocked_api.should_receive(:create_meeting)
|
647
646
|
.with(room.name, room.meetingid, params)
|
648
647
|
.and_return(hash_create)
|
@@ -1140,7 +1139,7 @@ describe BigbluebuttonRoom do
|
|
1140
1139
|
let(:user) { 'any user' }
|
1141
1140
|
before {
|
1142
1141
|
proc = double(Proc)
|
1143
|
-
proc.should_receive(:call).with(room, user)
|
1142
|
+
proc.should_receive(:call).with(room, user, {username: username, role: role} )
|
1144
1143
|
BigbluebuttonRails.configuration.should_receive(:get_join_options).and_return(proc)
|
1145
1144
|
room.stub(:fetch_new_token).and_return(nil)
|
1146
1145
|
room.stub(:join_url)
|
@@ -1151,7 +1150,7 @@ describe BigbluebuttonRoom do
|
|
1151
1150
|
context "if the user is not passed in the arguments" do
|
1152
1151
|
before {
|
1153
1152
|
proc = double(Proc)
|
1154
|
-
proc.should_receive(:call).with(room, nil)
|
1153
|
+
proc.should_receive(:call).with(room, nil, {username: username, role: role} )
|
1155
1154
|
BigbluebuttonRails.configuration.should_receive(:get_join_options).and_return(proc)
|
1156
1155
|
room.stub(:fetch_new_token).and_return(nil)
|
1157
1156
|
room.stub(:join_url)
|
@@ -1323,48 +1322,38 @@ describe BigbluebuttonRoom do
|
|
1323
1322
|
|
1324
1323
|
context "generates the dial number and saves in the room" do
|
1325
1324
|
before {
|
1326
|
-
|
1327
|
-
|
1328
|
-
it { room.generate_dial_number!.should be(true) }
|
1329
|
-
it {
|
1330
|
-
room.generate_dial_number!
|
1331
|
-
room.reload.dial_number.should eql("(99) 1234-5678")
|
1325
|
+
BigbluebuttonRoom.stub(:generate_dial_number).and_return("(99) 1234-5678")
|
1326
|
+
room.generate_dial_number!('x')
|
1332
1327
|
}
|
1328
|
+
it { room.reload.dial_number.should eql("(99) 1234-5678") }
|
1329
|
+
it { room.generate_dial_number!('x').should be(true) }
|
1333
1330
|
end
|
1334
1331
|
|
1335
1332
|
context "uses the pattern informed" do
|
1336
1333
|
before {
|
1337
|
-
|
1334
|
+
BigbluebuttonRoom.should_receive(:generate_dial_number).with("(99) 12xx-xxxx")
|
1338
1335
|
}
|
1339
1336
|
it { room.generate_dial_number!("(99) 12xx-xxxx").should be(true) }
|
1340
1337
|
end
|
1341
1338
|
|
1342
|
-
|
1339
|
+
context "returns nil if no pattern is given" do
|
1340
|
+
it { BigbluebuttonRoom.last.generate_dial_number!.should be(nil) }
|
1341
|
+
end
|
1342
|
+
end
|
1343
1343
|
|
1344
|
-
|
1345
|
-
|
1346
|
-
before {
|
1347
|
-
|
1348
|
-
expect(BigbluebuttonRails::DialNumber).to receive(:randomize).and_return("(99) 1234-5679") # unique
|
1349
|
-
}
|
1350
|
-
it { room.generate_dial_number!.should be(true) }
|
1351
|
-
it {
|
1352
|
-
room.generate_dial_number!
|
1353
|
-
room.reload.dial_number.should eql("(99) 1234-5679")
|
1354
|
-
}
|
1344
|
+
context "#generate_dial_number" do
|
1345
|
+
context "uses the last room creatd to set dial number" do
|
1346
|
+
before { BigbluebuttonRoom.last.update_attributes(dial_number: '1234-5678') }
|
1347
|
+
it { BigbluebuttonRoom.generate_dial_number('x').should eql('1234-5679') }
|
1355
1348
|
end
|
1356
1349
|
|
1357
|
-
context "
|
1358
|
-
before {
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
it {
|
1364
|
-
it {
|
1365
|
-
room.generate_dial_number!
|
1366
|
-
room.reload.dial_number.should eql(@previous_dn)
|
1367
|
-
}
|
1350
|
+
context "when the firt room is created" do
|
1351
|
+
before { BigbluebuttonRoom.first.delete }
|
1352
|
+
it { BigbluebuttonRoom.generate_dial_number('1234-xxxx').should eql('1234-0000') }
|
1353
|
+
end
|
1354
|
+
|
1355
|
+
context "returns nil if no pattern is given" do
|
1356
|
+
it { BigbluebuttonRoom.generate_dial_number.should be(nil) }
|
1368
1357
|
end
|
1369
1358
|
end
|
1370
1359
|
|
@@ -1625,7 +1614,7 @@ describe BigbluebuttonRoom do
|
|
1625
1614
|
|
1626
1615
|
context "if #create_time is not set in the room" do
|
1627
1616
|
before { room.update_attributes(create_time: nil) }
|
1628
|
-
subject { room.create_meeting_record }
|
1617
|
+
subject { room.create_meeting_record({}, server, nil, {}) }
|
1629
1618
|
it("doesn't create a meeting") {
|
1630
1619
|
BigbluebuttonMeeting.find_by(room_id: room.id).should be_nil
|
1631
1620
|
}
|
@@ -1769,7 +1758,7 @@ describe BigbluebuttonRoom do
|
|
1769
1758
|
let!(:meeting1) { FactoryGirl.create(:bigbluebutton_meeting, room: room, ended: false, running: true) }
|
1770
1759
|
let!(:meeting2) { FactoryGirl.create(:bigbluebutton_meeting, room: room, ended: false, running: true) }
|
1771
1760
|
before {
|
1772
|
-
expect(Resque).to receive(:enqueue_in).with(
|
1761
|
+
expect(Resque).to receive(:enqueue_in).with(1.minute, ::BigbluebuttonRecordingsForRoomWorker, room.id, 10)
|
1773
1762
|
}
|
1774
1763
|
it { room.finish_meetings }
|
1775
1764
|
end
|
@@ -1831,7 +1820,7 @@ describe BigbluebuttonRoom do
|
|
1831
1820
|
it { room.send(:internal_create_meeting) }
|
1832
1821
|
end
|
1833
1822
|
|
1834
|
-
context "adds the
|
1823
|
+
context "adds the invitation_url" do
|
1835
1824
|
before {
|
1836
1825
|
BigbluebuttonRails.configure do |config|
|
1837
1826
|
config.get_invitation_url = Proc.new do |room|
|
@@ -8,7 +8,7 @@ describe BigbluebuttonServer do
|
|
8
8
|
it { should have_db_column(:url).of_type(:string) }
|
9
9
|
it { should have_db_column(:secret).of_type(:string) }
|
10
10
|
it { should have_db_column(:version).of_type(:string) }
|
11
|
-
it { should have_db_column(:
|
11
|
+
it { should have_db_column(:slug).of_type(:string) }
|
12
12
|
it { should have_db_column(:created_at).of_type(:datetime) }
|
13
13
|
it { should have_db_column(:updated_at).of_type(:datetime) }
|
14
14
|
end
|
@@ -18,11 +18,11 @@ describe BigbluebuttonServer do
|
|
18
18
|
it { should validate_presence_of(:name) }
|
19
19
|
it { should validate_presence_of(:url) }
|
20
20
|
it { should validate_presence_of(:secret) }
|
21
|
-
it { should validate_presence_of(:
|
21
|
+
it { should validate_presence_of(:slug) }
|
22
22
|
|
23
23
|
context "uniqueness of" do
|
24
24
|
before(:each) { FactoryGirl.create(:bigbluebutton_server) }
|
25
|
-
it { should validate_uniqueness_of(:
|
25
|
+
it { should validate_uniqueness_of(:slug) }
|
26
26
|
end
|
27
27
|
|
28
28
|
it "has associated recordings" do
|
@@ -40,6 +40,8 @@ describe BigbluebuttonServer do
|
|
40
40
|
let!(:rec2) { FactoryGirl.create(:bigbluebutton_recording, server: server) }
|
41
41
|
let!(:rec3) { FactoryGirl.create(:bigbluebutton_recording) }
|
42
42
|
|
43
|
+
before { BigbluebuttonServer.any_instance.stub(:send_delete_recordings).and_return(true) }
|
44
|
+
|
43
45
|
it {
|
44
46
|
server.recordings.count.should eql(2)
|
45
47
|
server.destroy
|
@@ -52,13 +54,13 @@ describe BigbluebuttonServer do
|
|
52
54
|
it { should ensure_length_of(:name).is_at_least(1).is_at_most(500) }
|
53
55
|
it { should ensure_length_of(:url).is_at_most(500) }
|
54
56
|
it { should ensure_length_of(:secret).is_at_least(1).is_at_most(500) }
|
55
|
-
it { should ensure_length_of(:
|
57
|
+
it { should ensure_length_of(:slug).is_at_least(3) }
|
56
58
|
|
57
59
|
context ".to_param" do
|
58
60
|
it { should respond_to(:to_param) }
|
59
61
|
it {
|
60
62
|
s = FactoryGirl.create(:bigbluebutton_server)
|
61
|
-
s.to_param.should be(s.
|
63
|
+
s.to_param.should be(s.slug)
|
62
64
|
}
|
63
65
|
end
|
64
66
|
|
@@ -80,37 +82,35 @@ describe BigbluebuttonServer do
|
|
80
82
|
it { should_not allow_value('0.7').for(:version) }
|
81
83
|
end
|
82
84
|
|
83
|
-
context "
|
84
|
-
let(:msg) { I18n.t('bigbluebutton_rails.servers.errors.
|
85
|
-
it { should_not allow_value("123 321").for(:
|
86
|
-
it { should_not allow_value("").for(:
|
87
|
-
it { should_not allow_value("ab@c").for(:
|
88
|
-
it { should_not allow_value("ab#c").for(:
|
89
|
-
it { should_not allow_value("ab$c").for(:
|
90
|
-
it { should_not allow_value("ab%c").for(:
|
91
|
-
it { should_not allow_value("ábcd").for(:
|
92
|
-
it { should_not allow_value("-abc").for(:
|
93
|
-
it { should_not allow_value("abc-").for(:
|
94
|
-
it { should_not allow_value("-").for(:
|
95
|
-
it { should allow_value("_abc").for(:
|
96
|
-
it { should allow_value("abc_").for(:
|
97
|
-
it { should allow_value("abc").for(:
|
98
|
-
it { should allow_value("123").for(:
|
99
|
-
it { should allow_value("abc-123_d5").for(:
|
85
|
+
context "slug format" do
|
86
|
+
let(:msg) { I18n.t('bigbluebutton_rails.servers.errors.slug_format') }
|
87
|
+
it { should_not allow_value("123 321").for(:slug).with_message(msg) }
|
88
|
+
it { should_not allow_value("").for(:slug).with_message(msg) }
|
89
|
+
it { should_not allow_value("ab@c").for(:slug).with_message(msg) }
|
90
|
+
it { should_not allow_value("ab#c").for(:slug).with_message(msg) }
|
91
|
+
it { should_not allow_value("ab$c").for(:slug).with_message(msg) }
|
92
|
+
it { should_not allow_value("ab%c").for(:slug).with_message(msg) }
|
93
|
+
it { should_not allow_value("ábcd").for(:slug).with_message(msg) }
|
94
|
+
it { should_not allow_value("-abc").for(:slug).with_message(msg) }
|
95
|
+
it { should_not allow_value("abc-").for(:slug).with_message(msg) }
|
96
|
+
it { should_not allow_value("-").for(:slug).with_message(msg) }
|
97
|
+
it { should allow_value("_abc").for(:slug).with_message(msg) }
|
98
|
+
it { should allow_value("abc_").for(:slug).with_message(msg) }
|
99
|
+
it { should allow_value("abc").for(:slug).with_message(msg) }
|
100
|
+
it { should allow_value("123").for(:slug).with_message(msg) }
|
101
|
+
it { should allow_value("abc-123_d5").for(:slug).with_message(msg) }
|
100
102
|
end
|
101
103
|
|
102
104
|
context "sets param as the downcased parameterized name if param is" do
|
103
105
|
after :each do
|
104
106
|
@server.save.should be(true)
|
105
|
-
@server.
|
107
|
+
@server.slug.should == @server.name.downcase.parameterize
|
106
108
|
end
|
107
109
|
it "nil" do
|
108
|
-
@server = FactoryGirl.build(:bigbluebutton_server, :
|
109
|
-
:name => "-My Name@ _Is Odd_-")
|
110
|
+
@server = FactoryGirl.build(:bigbluebutton_server, slug: nil, name: "-My Name@ _Is Odd_-")
|
110
111
|
end
|
111
112
|
it "empty" do
|
112
|
-
@server = FactoryGirl.build(:bigbluebutton_server, :
|
113
|
-
:name => "-My Name@ _Is Odd_-")
|
113
|
+
@server = FactoryGirl.build(:bigbluebutton_server, slug: "", name: "-My Name@ _Is Odd_-")
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
@@ -10,7 +10,7 @@ When /^registers a new room$/i do
|
|
10
10
|
fill_in("bigbluebutton_room[dial_number]", :with => attrs[:dial_number])
|
11
11
|
fill_in("bigbluebutton_room[max_participants]", :with => attrs[:max_participants])
|
12
12
|
check("bigbluebutton_room[external]") if attrs[:external]
|
13
|
-
fill_in("bigbluebutton_room[
|
13
|
+
fill_in("bigbluebutton_room[slug]", :with => attrs[:slug])
|
14
14
|
# Note: voice_bridge is generated when the BigbluebuttonRoom is created
|
15
15
|
click_button("Create")
|
16
16
|
end
|
@@ -27,7 +27,7 @@ When /^registers a new room with wrong parameters$/i do
|
|
27
27
|
fill_in("bigbluebutton_room[dial_number]", :with => attrs[:dial_number])
|
28
28
|
fill_in("bigbluebutton_room[max_participants]", :with => attrs[:max_participants])
|
29
29
|
check("bigbluebutton_room[external]") if attrs[:external]
|
30
|
-
fill_in("bigbluebutton_room[
|
30
|
+
fill_in("bigbluebutton_room[slug]", :with => attrs[:slug])
|
31
31
|
click_button("Create")
|
32
32
|
end
|
33
33
|
|
@@ -4,7 +4,7 @@ When /^registers a new server$/i do
|
|
4
4
|
fill_in("bigbluebutton_server[url]", :with => attrs[:url])
|
5
5
|
fill_in("bigbluebutton_server[secret]", :with => attrs[:secret])
|
6
6
|
fill_in("bigbluebutton_server[version]", :with => attrs[:version])
|
7
|
-
fill_in("bigbluebutton_server[
|
7
|
+
fill_in("bigbluebutton_server[slug]", :with => attrs[:slug])
|
8
8
|
click_button("Create")
|
9
9
|
end
|
10
10
|
|
@@ -14,7 +14,7 @@ When /^registers a new server with a wrong URL$/i do
|
|
14
14
|
fill_in("bigbluebutton_server[url]", :with => "invalid url")
|
15
15
|
fill_in("bigbluebutton_server[secret]", :with => attrs[:secret])
|
16
16
|
fill_in("bigbluebutton_server[version]", :with => attrs[:version])
|
17
|
-
fill_in("bigbluebutton_server[
|
17
|
+
fill_in("bigbluebutton_server[slug]", :with => attrs[:slug])
|
18
18
|
click_button("Create")
|
19
19
|
end
|
20
20
|
|