bigbluebutton_rails 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/Gemfile.lock +5 -5
- data/app/controllers/bigbluebutton/rooms_controller.rb +0 -5
- data/app/controllers/bigbluebutton/servers_controller.rb +1 -1
- data/app/models/bigbluebutton_meeting.rb +2 -2
- data/app/models/bigbluebutton_recording.rb +16 -12
- data/app/models/bigbluebutton_room.rb +109 -42
- data/app/models/bigbluebutton_server.rb +10 -9
- 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_meeting_updater.rb +7 -14
- data/bigbluebutton_rails.gemspec +1 -1
- data/config/locales/en.yml +1 -1
- data/config/locales/pt-br.yml +1 -1
- data/lib/bigbluebutton_rails.rb +17 -10
- data/lib/bigbluebutton_rails/background_tasks.rb +9 -5
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/lib/generators/bigbluebutton_rails/templates/migration.rb +6 -2
- data/lib/generators/bigbluebutton_rails/templates/migration_2_1_0.rb +21 -0
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +1 -13
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +2 -2
- data/spec/factories/bigbluebutton_meeting.rb +2 -0
- data/spec/factories/bigbluebutton_metadata.rb +1 -1
- data/spec/factories/bigbluebutton_room.rb +1 -0
- data/spec/factories/bigbluebutton_server.rb +1 -1
- data/spec/lib/bigbluebutton_rails/background_tasks_spec.rb +106 -15
- data/spec/models/bigbluebutton_meeting_db_spec.rb +9 -4
- data/spec/models/bigbluebutton_meeting_spec.rb +2 -2
- data/spec/models/bigbluebutton_recording_spec.rb +19 -4
- data/spec/models/bigbluebutton_room_options_spec.rb +1 -1
- data/spec/models/bigbluebutton_room_spec.rb +396 -97
- data/spec/models/bigbluebutton_server_db_spec.rb +1 -1
- data/spec/models/bigbluebutton_server_spec.rb +38 -16
- data/spec/rails_app/db/seeds.rb +0 -1
- data/spec/rails_app/features/config.yml.example +2 -4
- data/spec/rails_app/features/step_definitions/activity_monitor_servers_step.rb +2 -4
- data/spec/rails_app/features/step_definitions/common_steps.rb +1 -2
- data/spec/rails_app/features/step_definitions/create_servers_steps.rb +2 -2
- data/spec/rails_app/features/step_definitions/destroy_servers_steps.rb +1 -2
- data/spec/rails_app/features/support/factories/bigbluebutton_server_integration.rb +1 -1
- data/spec/rails_app/features/support/templates.rb +5 -5
- data/spec/rails_app/lib/tasks/db/populate.rake +1 -1
- data/spec/workers/bigbluebutton_meeting_updater_spec.rb +86 -5
- metadata +5 -4
@@ -6,7 +6,7 @@ describe BigbluebuttonServer do
|
|
6
6
|
context "db" do
|
7
7
|
it { should have_db_column(:name).of_type(:string) }
|
8
8
|
it { should have_db_column(:url).of_type(:string) }
|
9
|
-
it { should have_db_column(:
|
9
|
+
it { should have_db_column(:secret).of_type(:string) }
|
10
10
|
it { should have_db_column(:version).of_type(:string) }
|
11
11
|
it { should have_db_column(:param).of_type(:string) }
|
12
12
|
it { should have_db_column(:created_at).of_type(:datetime) }
|
@@ -19,7 +19,7 @@ describe BigbluebuttonServer do
|
|
19
19
|
|
20
20
|
it { should validate_presence_of(:name) }
|
21
21
|
it { should validate_presence_of(:url) }
|
22
|
-
it { should validate_presence_of(:
|
22
|
+
it { should validate_presence_of(:secret) }
|
23
23
|
it { should validate_presence_of(:param) }
|
24
24
|
|
25
25
|
context "uniqueness of" do
|
@@ -49,7 +49,7 @@ describe BigbluebuttonServer do
|
|
49
49
|
|
50
50
|
it { should ensure_length_of(:name).is_at_least(1).is_at_most(500) }
|
51
51
|
it { should ensure_length_of(:url).is_at_most(500) }
|
52
|
-
it { should ensure_length_of(:
|
52
|
+
it { should ensure_length_of(:secret).is_at_least(1).is_at_most(500) }
|
53
53
|
it { should ensure_length_of(:param).is_at_least(3) }
|
54
54
|
|
55
55
|
context ".to_param" do
|
@@ -118,17 +118,21 @@ describe BigbluebuttonServer do
|
|
118
118
|
it { server.api.should_not be_nil }
|
119
119
|
|
120
120
|
context "with the correct attributes" do
|
121
|
-
let(:api) { BigBlueButton::BigBlueButtonApi.new(server.url, server.
|
121
|
+
let(:api) { BigBlueButton::BigBlueButtonApi.new(server.url, server.secret, server.version, false) }
|
122
122
|
it { server.api.should == api }
|
123
123
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
124
|
+
it {
|
125
|
+
server.url = 'http://anotherurl.com/bigbluebutton/api'
|
126
|
+
server.api.url.should eql('http://anotherurl.com/bigbluebutton/api')
|
127
|
+
}
|
128
|
+
it {
|
129
|
+
server.secret = '12345-abcde-67890-fghijk'
|
130
|
+
server.api.secret.should eql('12345-abcde-67890-fghijk')
|
131
|
+
}
|
132
|
+
it {
|
133
|
+
server.version = '0.9'
|
134
|
+
server.api.version.should eql('0.9')
|
135
|
+
}
|
132
136
|
end
|
133
137
|
|
134
138
|
context "returns the cached API object, if any" do
|
@@ -263,11 +267,29 @@ describe BigbluebuttonServer do
|
|
263
267
|
let(:response) { { :recordings => [1, 2] } }
|
264
268
|
before do
|
265
269
|
@api_mock.should_receive(:get_recordings).with(params).and_return(response)
|
266
|
-
BigbluebuttonRecording.should_receive(:sync).with(server, response[:recordings])
|
270
|
+
BigbluebuttonRecording.should_receive(:sync).with(server, response[:recordings], false)
|
267
271
|
end
|
268
272
|
it { server.fetch_recordings(params) }
|
269
273
|
end
|
270
274
|
|
275
|
+
context "calls get_recordings when `full_sync` is set" do
|
276
|
+
let(:response) { { :recordings => [1, 2] } }
|
277
|
+
before do
|
278
|
+
@api_mock.should_receive(:get_recordings).with(params).and_return(response)
|
279
|
+
BigbluebuttonRecording.should_receive(:sync).with(server, response[:recordings], true)
|
280
|
+
end
|
281
|
+
it { server.fetch_recordings(params, true) }
|
282
|
+
end
|
283
|
+
|
284
|
+
context "calls get_recordings when `filters` is not set" do
|
285
|
+
let(:response) { { :recordings => [1, 2] } }
|
286
|
+
before do
|
287
|
+
@api_mock.should_receive(:get_recordings).with({}).and_return(response)
|
288
|
+
BigbluebuttonRecording.should_receive(:sync).with(server, response[:recordings], false)
|
289
|
+
end
|
290
|
+
it { server.fetch_recordings }
|
291
|
+
end
|
292
|
+
|
271
293
|
context "when the response is empty" do
|
272
294
|
let(:response) { { :recordings => [1, 2] } }
|
273
295
|
before do
|
@@ -339,9 +361,9 @@ describe BigbluebuttonServer do
|
|
339
361
|
it { server.update_attributes(url: server.url + "-2") }
|
340
362
|
end
|
341
363
|
|
342
|
-
context "if #
|
364
|
+
context "if #secret changed" do
|
343
365
|
before { server.should_receive(:update_config).once }
|
344
|
-
it { server.update_attributes(
|
366
|
+
it { server.update_attributes(secret: server.secret + "-2") }
|
345
367
|
end
|
346
368
|
|
347
369
|
context "if #version changed" do
|
@@ -374,9 +396,9 @@ describe BigbluebuttonServer do
|
|
374
396
|
it { server.update_attributes(url: server.url + "-2") }
|
375
397
|
end
|
376
398
|
|
377
|
-
context "if #
|
399
|
+
context "if #secret changed" do
|
378
400
|
before { server.should_receive(:set_api_version_from_server).once }
|
379
|
-
it { server.update_attributes(
|
401
|
+
it { server.update_attributes(secret: server.secret + "-2") }
|
380
402
|
end
|
381
403
|
|
382
404
|
context "if #version changed" do
|
data/spec/rails_app/db/seeds.rb
CHANGED
@@ -3,10 +3,8 @@ timeout_bot_start: 60
|
|
3
3
|
|
4
4
|
servers:
|
5
5
|
bbb-dev-07:
|
6
|
-
|
6
|
+
secret: 'your-secret'
|
7
7
|
url: 'http://your-server/bigbluebutton/api'
|
8
|
-
version: '0.9'
|
9
8
|
test-install-09:
|
10
|
-
|
9
|
+
secret: '8cd8ef52e8e101574e400365b55e11a6'
|
11
10
|
url: 'http://test-install.blindsidenetworks.com/bigbluebutton/api'
|
12
|
-
version: '0.9'
|
@@ -1,20 +1,18 @@
|
|
1
1
|
When /^(\d+) meetings running in this server$/ do |count|
|
2
|
-
msalt = FeaturesConfig.server.has_key?('mobile_salt') ? FeaturesConfig.server['mobile_salt'] : ""
|
3
2
|
@rooms = []
|
4
3
|
count.to_i.times do |i|
|
5
4
|
room = FactoryGirl.create(:bigbluebutton_room, :server => @server)
|
6
|
-
BigBlueButtonBot.new(@server.api, room.meetingid,
|
5
|
+
BigBlueButtonBot.new(@server.api, room.meetingid, nil, 1,
|
7
6
|
FeaturesConfig.root['timeout_bot_start'])
|
8
7
|
@rooms << room
|
9
8
|
end
|
10
9
|
end
|
11
10
|
|
12
11
|
When /^(\d+) meetings recently ended in this server$/ do |count|
|
13
|
-
msalt = FeaturesConfig.server.has_key?('mobile_salt') ? FeaturesConfig.server['mobile_salt'] : ""
|
14
12
|
@ended_rooms = []
|
15
13
|
count.to_i.times do |i|
|
16
14
|
room = FactoryGirl.create(:bigbluebutton_room, :server => @server)
|
17
|
-
BigBlueButtonBot.new(@server.api, room.meetingid,
|
15
|
+
BigBlueButtonBot.new(@server.api, room.meetingid, nil, 1,
|
18
16
|
FeaturesConfig.root['timeout_bot_start'])
|
19
17
|
BigBlueButtonBot.finalize(room.meetingid)
|
20
18
|
sleep 1
|
@@ -102,8 +102,7 @@ When /^a meeting is running in this room$/ do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
When /^a meeting is running in this room with (\d+) attendees$/ do |count|
|
105
|
-
|
106
|
-
BigBlueButtonBot.new(@server.api, @room.meetingid, msalt,
|
105
|
+
BigBlueButtonBot.new(@server.api, @room.meetingid, nil,
|
107
106
|
count.to_i, FeaturesConfig.root['timeout_bot_start'])
|
108
107
|
end
|
109
108
|
|
@@ -2,7 +2,7 @@ When /^registers a new server$/i do
|
|
2
2
|
attrs = FactoryGirl.attributes_for(:bigbluebutton_server_integration)
|
3
3
|
fill_in("bigbluebutton_server[name]", :with => attrs[:name])
|
4
4
|
fill_in("bigbluebutton_server[url]", :with => attrs[:url])
|
5
|
-
fill_in("bigbluebutton_server[
|
5
|
+
fill_in("bigbluebutton_server[secret]", :with => attrs[:secret])
|
6
6
|
fill_in("bigbluebutton_server[version]", :with => attrs[:version])
|
7
7
|
fill_in("bigbluebutton_server[param]", :with => attrs[:param])
|
8
8
|
click_button("Create")
|
@@ -12,7 +12,7 @@ When /^registers a new server with a wrong URL$/i do
|
|
12
12
|
attrs = FactoryGirl.attributes_for(:bigbluebutton_server_integration)
|
13
13
|
fill_in("bigbluebutton_server[name]", :with => attrs[:name])
|
14
14
|
fill_in("bigbluebutton_server[url]", :with => "invalid url")
|
15
|
-
fill_in("bigbluebutton_server[
|
15
|
+
fill_in("bigbluebutton_server[secret]", :with => attrs[:secret])
|
16
16
|
fill_in("bigbluebutton_server[version]", :with => attrs[:version])
|
17
17
|
fill_in("bigbluebutton_server[param]", :with => attrs[:param])
|
18
18
|
click_button("Create")
|
@@ -9,7 +9,6 @@ When /^the removed server should not be listed$/i do
|
|
9
9
|
# check params that are specific for this server
|
10
10
|
doesnt_have_content(@server.name)
|
11
11
|
doesnt_have_content(@server.url)
|
12
|
-
doesnt_have_content(@server.
|
12
|
+
doesnt_have_content(@server.secret)
|
13
13
|
doesnt_have_content(@server.param)
|
14
14
|
end
|
15
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
FactoryGirl.define do
|
2
2
|
factory :bigbluebutton_server_integration, :parent => :bigbluebutton_server do |s|
|
3
3
|
s.url { FeaturesConfig.server["url"] }
|
4
|
-
s.
|
4
|
+
s.secret { FeaturesConfig.server["secret"] }
|
5
5
|
s.version { FeaturesConfig.server["version"] }
|
6
6
|
end
|
7
7
|
end
|
@@ -33,15 +33,15 @@ module TemplateHelpers
|
|
33
33
|
{ :name => 'bigbluebutton_server[name]', :type => 'text' })
|
34
34
|
has_element("input#bigbluebutton_server_url",
|
35
35
|
{ :name => 'bigbluebutton_server[url]', :type => 'text' })
|
36
|
-
has_element("input#
|
37
|
-
{ :name => 'bigbluebutton_server[
|
36
|
+
has_element("input#bigbluebutton_server_secret",
|
37
|
+
{ :name => 'bigbluebutton_server[secret]', :type => 'text' })
|
38
38
|
has_element("input#bigbluebutton_server_version",
|
39
39
|
{ :name => 'bigbluebutton_server[version]', :type => 'text' })
|
40
40
|
has_element("input#bigbluebutton_server_param",
|
41
41
|
{ :name => 'bigbluebutton_server[param]', :type => 'text' })
|
42
42
|
has_element("label", { :for => 'bigbluebutton_server_name' })
|
43
43
|
has_element("label", { :for => 'bigbluebutton_server_url' })
|
44
|
-
has_element("label", { :for => '
|
44
|
+
has_element("label", { :for => 'bigbluebutton_server_secret' })
|
45
45
|
has_element("label", { :for => 'bigbluebutton_server_version' })
|
46
46
|
has_element("label", { :for => 'bigbluebutton_server_param' })
|
47
47
|
has_element("input", { :name => 'commit', :type => 'submit' })
|
@@ -53,7 +53,7 @@ module TemplateHelpers
|
|
53
53
|
|
54
54
|
page_has_content(server.name)
|
55
55
|
page_has_content(server.url)
|
56
|
-
page_has_content(server.
|
56
|
+
page_has_content(server.secret)
|
57
57
|
page_has_content(server.version)
|
58
58
|
page_has_content(server.param)
|
59
59
|
has_element("a", { :href => edit_bigbluebutton_server_path(server) }) # edit
|
@@ -74,7 +74,7 @@ module TemplateHelpers
|
|
74
74
|
# server data
|
75
75
|
has_content(server.name)
|
76
76
|
has_content(server.url)
|
77
|
-
has_content(server.
|
77
|
+
has_content(server.secret)
|
78
78
|
has_content(server.version)
|
79
79
|
has_content(server.param)
|
80
80
|
has_content(server.url)
|
@@ -27,7 +27,7 @@ namespace :db do
|
|
27
27
|
params = {
|
28
28
|
:name => "Server #{n1}",
|
29
29
|
:url => "http://bigbluebutton#{n1}.test.com/bigbluebutton/api",
|
30
|
-
:
|
30
|
+
:secret => Forgery(:basic).password(:at_least => 30, :at_most => 40),
|
31
31
|
:version => '0.9',
|
32
32
|
:param => "server-#{n1}"
|
33
33
|
}
|
@@ -1,9 +1,90 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe BigbluebuttonMeetingUpdater do
|
4
|
-
|
5
|
-
it "
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
|
5
|
+
it "uses the queue :bigbluebutton_rails" do
|
6
|
+
BigbluebuttonMeetingUpdater.instance_variable_get(:@queue).should eql(:bigbluebutton_rails)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "#perform" do
|
10
|
+
let!(:api) { double(BigBlueButton::BigBlueButtonApi) }
|
11
|
+
|
12
|
+
it "waits the amount of time specified before starting"
|
13
|
+
|
14
|
+
context "calls fetch_meeting_info in the target room" do
|
15
|
+
let!(:room) { FactoryGirl.create(:bigbluebutton_room) }
|
16
|
+
|
17
|
+
before {
|
18
|
+
expect(BigbluebuttonRoom).to receive(:find).with(room.id).and_return(room)
|
19
|
+
expect(room).to receive(:fetch_meeting_info).once
|
20
|
+
}
|
21
|
+
it { BigbluebuttonMeetingUpdater.perform(room.id) }
|
22
|
+
end
|
23
|
+
|
24
|
+
context "calls finish_meetings if an exception 'notFound' is raised" do
|
25
|
+
let!(:room) { FactoryGirl.create(:bigbluebutton_room) }
|
26
|
+
let!(:exception) {
|
27
|
+
e = BigBlueButton::BigBlueButtonException.new('Test error')
|
28
|
+
e.key = 'notFound'
|
29
|
+
e
|
30
|
+
}
|
31
|
+
|
32
|
+
before {
|
33
|
+
expect(BigbluebuttonRoom).to receive(:find).with(room.id).and_return(room)
|
34
|
+
room.server.stub(:api) { api }
|
35
|
+
expect(api).to receive(:get_meeting_info).once { raise exception }
|
36
|
+
expect(room).to receive(:finish_meetings).once
|
37
|
+
}
|
38
|
+
it { expect { BigbluebuttonMeetingUpdater.perform(room.id) }.not_to raise_exception }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "calls finish_meetings if an exception other than 'notFound' is raised" do
|
42
|
+
let!(:room) { FactoryGirl.create(:bigbluebutton_room) }
|
43
|
+
let!(:exception) {
|
44
|
+
e = BigBlueButton::BigBlueButtonException.new('Test error')
|
45
|
+
e.key = 'anythingElse'
|
46
|
+
e
|
47
|
+
}
|
48
|
+
|
49
|
+
before {
|
50
|
+
expect(BigbluebuttonRoom).to receive(:find).with(room.id).and_return(room)
|
51
|
+
room.server.stub(:api) { api }
|
52
|
+
expect(api).to receive(:get_meeting_info).once { raise exception }
|
53
|
+
expect(room).to receive(:finish_meetings)
|
54
|
+
}
|
55
|
+
it { expect { BigbluebuttonMeetingUpdater.perform(room.id) }.not_to raise_exception }
|
56
|
+
end
|
57
|
+
|
58
|
+
context "calls finish_meetings if an exception with a blank key is raised" do
|
59
|
+
let!(:room) { FactoryGirl.create(:bigbluebutton_room) }
|
60
|
+
let!(:exception) {
|
61
|
+
e = BigBlueButton::BigBlueButtonException.new('Test error')
|
62
|
+
e.key = ''
|
63
|
+
e
|
64
|
+
}
|
65
|
+
|
66
|
+
before {
|
67
|
+
expect(BigbluebuttonRoom).to receive(:find).with(room.id).and_return(room)
|
68
|
+
room.server.stub(:api) { api }
|
69
|
+
expect(api).to receive(:get_meeting_info).once { raise exception }
|
70
|
+
expect(room).to receive(:finish_meetings)
|
71
|
+
}
|
72
|
+
it { expect { BigbluebuttonMeetingUpdater.perform(room.id) }.not_to raise_exception }
|
73
|
+
end
|
74
|
+
|
75
|
+
context "doesn't break if the room is not found" do
|
76
|
+
let!(:room) { FactoryGirl.create(:bigbluebutton_room) }
|
77
|
+
let!(:exception) {
|
78
|
+
e = BigBlueButton::BigBlueButtonException.new('Test error')
|
79
|
+
e.key = ''
|
80
|
+
}
|
81
|
+
|
82
|
+
before {
|
83
|
+
expect(BigbluebuttonRoom).to receive(:find).with(room.id).and_return(nil)
|
84
|
+
expect(room).not_to receive(:fetch_meeting_info)
|
85
|
+
expect(room).not_to receive(:finish_meetings)
|
86
|
+
}
|
87
|
+
it { BigbluebuttonMeetingUpdater.perform(room.id) }
|
88
|
+
end
|
89
|
+
end
|
9
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigbluebutton_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mconf
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-07-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -31,14 +31,14 @@ dependencies:
|
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: '1.6'
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.
|
41
|
+
version: '1.6'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: resque
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,6 +172,7 @@ files:
|
|
172
172
|
- lib/generators/bigbluebutton_rails/templates/migration_1_3_0_b.rb
|
173
173
|
- lib/generators/bigbluebutton_rails/templates/migration_1_4_0.rb
|
174
174
|
- lib/generators/bigbluebutton_rails/templates/migration_2_0_0.rb
|
175
|
+
- lib/generators/bigbluebutton_rails/templates/migration_2_1_0.rb
|
175
176
|
- lib/generators/bigbluebutton_rails/views_generator.rb
|
176
177
|
- lib/tasks/bigbluebutton_rails/meetings.rake
|
177
178
|
- lib/tasks/bigbluebutton_rails/recordings.rake
|