bigbluebutton_rails 0.1.1 → 1.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.
- data/CHANGELOG.rdoc +1 -12
- data/Gemfile.lock +1 -1
- data/README.rdoc +32 -46
- data/Rakefile +1 -0
- data/app/controllers/bigbluebutton/rooms_controller.rb +16 -17
- data/app/controllers/bigbluebutton/servers_controller.rb +2 -6
- data/app/models/bigbluebutton_room.rb +1 -35
- data/app/models/bigbluebutton_server.rb +1 -1
- data/app/views/bigbluebutton/rooms/_form.html.erb +3 -7
- data/app/views/bigbluebutton/rooms/edit.html.erb +2 -2
- data/app/views/bigbluebutton/rooms/external.html.erb +1 -2
- data/app/views/bigbluebutton/rooms/index.html.erb +37 -2
- 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 +4 -10
- data/app/views/bigbluebutton/servers/_activity_list.html.erb +6 -6
- data/app/views/bigbluebutton/servers/index.html.erb +3 -4
- data/app/views/bigbluebutton/servers/show.html.erb +4 -3
- data/config/locales/en.yml +3 -7
- data/lib/bigbluebutton_rails/exceptions.rb +0 -4
- data/lib/bigbluebutton_rails/rails/routes.rb +35 -28
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +10 -13
- data/spec/controllers/bigbluebutton/rooms_controller_json_responses_spec.rb +13 -13
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +115 -114
- data/spec/controllers/bigbluebutton/servers_controller_json_responses_spec.rb +1 -12
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +0 -11
- data/spec/generators/install_generator_spec.rb +1 -1
- data/spec/models/bigbluebutton_room_spec.rb +80 -166
- data/spec/models/bigbluebutton_server_spec.rb +4 -4
- data/spec/rails_app/features/activity_monitor_servers.feature +0 -6
- data/spec/rails_app/features/create_rooms.feature +0 -5
- data/spec/rails_app/features/create_servers.feature +2 -7
- data/spec/rails_app/features/edit_rooms.feature +0 -7
- data/spec/rails_app/features/edit_servers.feature +2 -8
- data/spec/rails_app/features/join_rooms.feature +0 -1
- data/spec/rails_app/features/list_and_show_rooms.feature +2 -10
- data/spec/rails_app/features/step_definitions/activity_monitor_servers_step.rb +10 -10
- data/spec/rails_app/features/step_definitions/common_steps.rb +4 -6
- data/spec/rails_app/features/step_definitions/create_rooms_steps.rb +0 -1
- data/spec/rails_app/features/step_definitions/join_mobile_steps.rb +3 -1
- data/spec/rails_app/features/step_definitions/join_rooms_steps.rb +7 -3
- data/spec/rails_app/features/step_definitions/list_and_show_rooms_steps.rb +5 -12
- data/spec/rails_app/features/step_definitions/list_and_show_servers_steps.rb +5 -1
- data/spec/rails_app/features/support/{patches/application_controller.rb → application_controller.rb} +0 -0
- data/spec/rails_app/features/support/paths.rb +10 -12
- data/spec/rails_app/features/support/templates.rb +46 -90
- data/spec/routing/bigbluebutton/custom_controllers_routing_spec.rb +22 -38
- data/spec/routing/bigbluebutton/rooms_routing_spec.rb +58 -142
- data/spec/routing/bigbluebutton/servers_routing_spec.rb +1 -9
- metadata +9 -12
- data/app/views/bigbluebutton/rooms/_rooms.html.erb +0 -37
- data/app/views/bigbluebutton/servers/rooms.html.erb +0 -2
- data/spec/rails_app/features/support/patches/bigbluebutton_room.rb +0 -9
@@ -3,8 +3,4 @@ module BigbluebuttonRails
|
|
3
3
|
# Raised when the user is not authorized to join a room
|
4
4
|
class RoomAccessDenied < StandardError; end
|
5
5
|
|
6
|
-
# Raised when an action that requires a server is called for a
|
7
|
-
# room that does not have a server associated
|
8
|
-
class ServerRequired < StandardError; end
|
9
|
-
|
10
6
|
end
|
@@ -13,23 +13,23 @@ module ActionDispatch::Routing
|
|
13
13
|
#
|
14
14
|
# Passing the option :default, it will generate the default routes to access
|
15
15
|
# bigbluebutton servers and rooms. These routes are the resourceful routes generated
|
16
|
-
# by rails to a resource, plus
|
16
|
+
# by rails to a resource, plus two new actions for the rooms.
|
17
17
|
#
|
18
18
|
# bigbluebutton_routes :default
|
19
19
|
#
|
20
|
-
#
|
20
|
+
# Some routes generated:
|
21
21
|
#
|
22
22
|
# bigbluebutton_server GET /bigbluebutton/servers/:id(.:format)
|
23
23
|
# { :action=>"show", :controller=>"bigbluebutton/servers" }
|
24
24
|
# POST /bigbluebutton/servers/:id(.:format)
|
25
25
|
# { :action=>"update", :controller=>"bigbluebutton/servers" }
|
26
|
-
#
|
26
|
+
# join_bigbluebutton_server_room GET /bigbluebutton/servers/:server_id/rooms/:id/join(.:format)
|
27
27
|
# { :action=>"join", :controller=>"bigbluebutton/rooms" }
|
28
|
-
#
|
28
|
+
# running_bigbluebutton_server_room GET /bigbluebutton/servers/:server_id/rooms/:id/running(.:format)
|
29
29
|
# { :action=>"running", :controller=>"bigbluebutton/rooms" }
|
30
30
|
#
|
31
31
|
# The routes point by default to the controllers Bigbluebutton::ServersController and Bigbluebutton::RoomsController
|
32
|
-
# and
|
32
|
+
# and the the routes are scoped (namespaced) with 'bigbluebutton'. You can change the namespace with:
|
33
33
|
#
|
34
34
|
# bigbluebutton_routes :default, :scope => "webconference"
|
35
35
|
#
|
@@ -40,8 +40,7 @@ module ActionDispatch::Routing
|
|
40
40
|
# ==== Room matchers
|
41
41
|
#
|
42
42
|
# Generates matchers to access a room from a different url or inside another resource.
|
43
|
-
#
|
44
|
-
# This helper creates routes to the all the actions available in Bigbluebutton::RoomsController.
|
43
|
+
# It creates routes to the actions #show, #join, #running, #end, #invite, and #auth.
|
45
44
|
#
|
46
45
|
# bigbluebutton_routes :room_matchers
|
47
46
|
#
|
@@ -51,12 +50,18 @@ module ActionDispatch::Routing
|
|
51
50
|
# bigbluebutton_routes :room_matchers
|
52
51
|
# end
|
53
52
|
#
|
54
|
-
#
|
53
|
+
# The routes generated are:
|
55
54
|
#
|
56
55
|
# user_room GET /users/:user_id/room/:id(.:format)
|
57
56
|
# { :controller=>"bigbluebutton/rooms", :action=>"show" }
|
58
57
|
# user_join_room GET /users/:user_id/room/:id/join(.:format)
|
59
58
|
# { :controller=>"bigbluebutton/rooms", :action=>"join" }
|
59
|
+
# user_join_mobile_room GET /users/:user_id/room/:id/invite(.:format)
|
60
|
+
# { :controller=>"bigbluebutton/rooms", :action=>"invite" }
|
61
|
+
# user_auth_room POST /users/:user_id/room/:id/join(.:format)
|
62
|
+
# { :controller=>"bigbluebutton/rooms", :action=>"auth" }
|
63
|
+
# user_running_room GET /users/:user_id/room/:id/running(.:format)
|
64
|
+
# { :controller=>"bigbluebutton/rooms", :action=>"running" }
|
60
65
|
# user_end_room GET /users/:user_id/room/:id/end(.:format)
|
61
66
|
# { :controller=>"bigbluebutton/rooms", :action=>"end" }
|
62
67
|
# user_invite_room GET /users/:user_id/room/:id/invite(.:format)
|
@@ -77,31 +82,33 @@ module ActionDispatch::Routing
|
|
77
82
|
scope options_scope, :as => options_scope do
|
78
83
|
resources :servers, :controller => BigbluebuttonRails.controllers[:servers] do
|
79
84
|
get :activity, :on => :member
|
80
|
-
|
85
|
+
resources :rooms, :controller => BigbluebuttonRails.controllers[:rooms] do
|
86
|
+
collection do
|
87
|
+
get :external
|
88
|
+
post :external, :action => :external_auth
|
89
|
+
end
|
90
|
+
member do
|
91
|
+
get :join
|
92
|
+
get :running
|
93
|
+
get :end
|
94
|
+
get :invite
|
95
|
+
get :join_mobile
|
96
|
+
post :join, :action => :auth
|
97
|
+
end
|
98
|
+
end
|
81
99
|
end
|
82
|
-
add_routes_for_rooms
|
83
100
|
end
|
84
101
|
end
|
85
102
|
|
86
103
|
def bigbluebutton_routes_room_matchers(*params) #:nodoc:
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
end
|
96
|
-
member do
|
97
|
-
get :join
|
98
|
-
get :running
|
99
|
-
get :end
|
100
|
-
get :invite
|
101
|
-
get :join_mobile
|
102
|
-
post :join, :action => :auth
|
103
|
-
end
|
104
|
-
end
|
104
|
+
# TODO This is generating helpers like "user_running_room" instead of "running_user_room"
|
105
|
+
get 'room/:id' => "#{BigbluebuttonRails.controllers[:rooms]}#show", :as => 'room'
|
106
|
+
get 'room/:id/join' => "#{BigbluebuttonRails.controllers[:rooms]}#join", :as => 'join_room'
|
107
|
+
get 'room/:id/join_mobile' => "#{BigbluebuttonRails.controllers[:rooms]}#join_mobile", :as => 'join_mobile_room'
|
108
|
+
post 'room/:id/join' => "#{BigbluebuttonRails.controllers[:rooms]}#auth", :as => 'join_room'
|
109
|
+
get 'room/:id/running' => "#{BigbluebuttonRails.controllers[:rooms]}#running", :as => 'running_room'
|
110
|
+
get 'room/:id/end' => "#{BigbluebuttonRails.controllers[:rooms]}#end", :as => 'end_room'
|
111
|
+
get 'room/:id/invite' => "#{BigbluebuttonRails.controllers[:rooms]}#invite", :as => 'invite_room'
|
105
112
|
end
|
106
113
|
|
107
114
|
end
|
@@ -2,13 +2,14 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Bigbluebutton::RoomsController do
|
4
4
|
render_views
|
5
|
+
let(:server) { Factory.create(:bigbluebutton_server) }
|
6
|
+
let(:room) { Factory.create(:bigbluebutton_room, :server => server) }
|
5
7
|
|
6
8
|
# make sure that the exceptions thrown by bigbluebutton-api-ruby are treated by the controller
|
7
9
|
context "exception handling" do
|
8
10
|
let(:bbb_error_msg) { "err msg" }
|
9
11
|
let(:bbb_error) { BigBlueButton::BigBlueButtonException.new(bbb_error_msg) }
|
10
12
|
let(:http_referer) { bigbluebutton_server_path(mocked_server) }
|
11
|
-
let(:room) { Factory.create(:bigbluebutton_room, :server => mocked_server) }
|
12
13
|
before {
|
13
14
|
mock_server_and_api
|
14
15
|
request.env["HTTP_REFERER"] = http_referer
|
@@ -25,16 +26,16 @@ describe Bigbluebutton::RoomsController do
|
|
25
26
|
end
|
26
27
|
|
27
28
|
after :each do
|
28
|
-
delete :destroy, :id => room.to_param
|
29
|
+
delete :destroy, :server_id => mocked_server.to_param, :id => room.to_param
|
29
30
|
should respond_with(:redirect)
|
30
|
-
should redirect_to
|
31
|
+
should redirect_to bigbluebutton_server_rooms_url
|
31
32
|
should set_the_flash.to(bbb_error_msg)
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
36
|
describe "#running" do
|
36
37
|
before { mocked_api.should_receive(:is_meeting_running?) { raise bbb_error } }
|
37
|
-
before(:each) { get :running, :id => room.to_param }
|
38
|
+
before(:each) { get :running, :server_id => mocked_server.to_param, :id => room.to_param }
|
38
39
|
it { should respond_with(:success) }
|
39
40
|
it { response.body.should == build_running_json(false, bbb_error_msg) }
|
40
41
|
it { should set_the_flash.to(bbb_error_msg) }
|
@@ -51,7 +52,7 @@ describe Bigbluebutton::RoomsController do
|
|
51
52
|
end
|
52
53
|
|
53
54
|
after :each do
|
54
|
-
get :end, :id => room.to_param
|
55
|
+
get :end, :server_id => mocked_server.to_param, :id => room.to_param
|
55
56
|
should respond_with(:redirect)
|
56
57
|
should redirect_to(http_referer)
|
57
58
|
should set_the_flash.to(bbb_error_msg)
|
@@ -62,11 +63,7 @@ describe Bigbluebutton::RoomsController do
|
|
62
63
|
before { controller.stub(:bigbluebutton_user) { Factory.build(:user) } }
|
63
64
|
|
64
65
|
context "as moderator" do
|
65
|
-
before {
|
66
|
-
controller.should_receive(:bigbluebutton_role).with(room).and_return(:moderator)
|
67
|
-
room.stub(:select_server).and_return(mocked_server)
|
68
|
-
BigbluebuttonRoom.stub(:find_by_param).and_return(room)
|
69
|
-
}
|
66
|
+
before { controller.should_receive(:bigbluebutton_role).with(room).and_return(:moderator) }
|
70
67
|
|
71
68
|
it "catches exception on is_meeting_running" do
|
72
69
|
mocked_api.should_receive(:is_meeting_running?) { raise bbb_error }
|
@@ -83,7 +80,7 @@ describe Bigbluebutton::RoomsController do
|
|
83
80
|
end
|
84
81
|
|
85
82
|
after :each do
|
86
|
-
get :join, :id => room.to_param
|
83
|
+
get :join, :server_id => mocked_server.to_param, :id => room.to_param
|
87
84
|
should respond_with(:redirect)
|
88
85
|
should redirect_to(http_referer)
|
89
86
|
should set_the_flash.to(bbb_error_msg)
|
@@ -91,7 +88,7 @@ describe Bigbluebutton::RoomsController do
|
|
91
88
|
|
92
89
|
end
|
93
90
|
|
94
|
-
context "as
|
91
|
+
context "as moderator" do
|
95
92
|
before { controller.should_receive(:bigbluebutton_role).with(room).and_return(:attendee) }
|
96
93
|
|
97
94
|
it "catches exception on is_meeting_running" do
|
@@ -104,7 +101,7 @@ describe Bigbluebutton::RoomsController do
|
|
104
101
|
end
|
105
102
|
|
106
103
|
after :each do
|
107
|
-
get :join, :id => room.to_param
|
104
|
+
get :join, :server_id => mocked_server.to_param, :id => room.to_param
|
108
105
|
should respond_with(:redirect)
|
109
106
|
should redirect_to(http_referer)
|
110
107
|
should set_the_flash.to(bbb_error_msg)
|
@@ -5,21 +5,21 @@ describe Bigbluebutton::RoomsController do
|
|
5
5
|
let(:server) { Factory.create(:bigbluebutton_server) }
|
6
6
|
let(:room) { Factory.create(:bigbluebutton_room, :server => server) }
|
7
7
|
|
8
|
-
context "json responses for" do
|
8
|
+
context "json responses for " do
|
9
9
|
|
10
10
|
describe "#index" do
|
11
11
|
before do
|
12
12
|
@room1 = Factory.create(:bigbluebutton_room, :server => server)
|
13
13
|
@room2 = Factory.create(:bigbluebutton_room, :server => server)
|
14
14
|
end
|
15
|
-
before(:each) { get :index, :format => 'json' }
|
15
|
+
before(:each) { get :index, :server_id => server.to_param, :format => 'json' }
|
16
16
|
it { should respond_with(:success) }
|
17
17
|
it { should respond_with_content_type(:json) }
|
18
18
|
it { should respond_with_json([@room1, @room2].to_json) }
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "#new" do
|
22
|
-
before(:each) { get :new, :format => 'json' }
|
22
|
+
before(:each) { get :new, :server_id => server.to_param, :format => 'json' }
|
23
23
|
it { should respond_with(:success) }
|
24
24
|
it { should respond_with_content_type(:json) }
|
25
25
|
it {
|
@@ -30,7 +30,7 @@ describe Bigbluebutton::RoomsController do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "#show" do
|
33
|
-
before(:each) { get :show, :id => room.to_param, :format => 'json' }
|
33
|
+
before(:each) { get :show, :server_id => server.to_param, :id => room.to_param, :format => 'json' }
|
34
34
|
it { should respond_with(:success) }
|
35
35
|
it { should respond_with_content_type(:json) }
|
36
36
|
it { should respond_with_json(room.to_json) }
|
@@ -41,7 +41,7 @@ describe Bigbluebutton::RoomsController do
|
|
41
41
|
|
42
42
|
context "on success" do
|
43
43
|
before(:each) {
|
44
|
-
post :create, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
44
|
+
post :create, :server_id => server.to_param, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
45
45
|
}
|
46
46
|
it { should respond_with(:created) }
|
47
47
|
it { should respond_with_content_type(:json) }
|
@@ -54,7 +54,7 @@ describe Bigbluebutton::RoomsController do
|
|
54
54
|
context "on failure" do
|
55
55
|
before(:each) {
|
56
56
|
new_room.name = nil # invalid
|
57
|
-
post :create, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
57
|
+
post :create, :server_id => server.to_param, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
58
58
|
}
|
59
59
|
it { should respond_with(:unprocessable_entity) }
|
60
60
|
it { should respond_with_content_type(:json) }
|
@@ -71,7 +71,7 @@ describe Bigbluebutton::RoomsController do
|
|
71
71
|
|
72
72
|
context "on success" do
|
73
73
|
before(:each) {
|
74
|
-
put :update, :id => @room.to_param, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
74
|
+
put :update, :server_id => server.to_param, :id => @room.to_param, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
75
75
|
}
|
76
76
|
it { should respond_with(:success) }
|
77
77
|
it { should respond_with_content_type(:json) }
|
@@ -84,7 +84,7 @@ describe Bigbluebutton::RoomsController do
|
|
84
84
|
context "on failure" do
|
85
85
|
before(:each) {
|
86
86
|
new_room.name = nil # invalid
|
87
|
-
put :update, :id => @room.to_param, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
87
|
+
put :update, :server_id => server.to_param, :id => @room.to_param, :bigbluebutton_room => new_room.attributes, :format => 'json'
|
88
88
|
}
|
89
89
|
it { should respond_with(:unprocessable_entity) }
|
90
90
|
it { should respond_with_content_type(:json) }
|
@@ -103,7 +103,7 @@ describe Bigbluebutton::RoomsController do
|
|
103
103
|
mocked_api.should_receive(:is_meeting_running?).and_return(true)
|
104
104
|
mocked_api.should_receive(:end_meeting).with(room.meetingid, room.moderator_password)
|
105
105
|
}
|
106
|
-
before(:each) { get :end, :id => room.to_param, :format => 'json' }
|
106
|
+
before(:each) { get :end, :server_id => mocked_server.to_param, :id => room.to_param, :format => 'json' }
|
107
107
|
it { should respond_with(:success) }
|
108
108
|
it { should respond_with_content_type(:json) }
|
109
109
|
it { should respond_with_json(I18n.t('bigbluebutton_rails.rooms.notice.end.success')) }
|
@@ -111,7 +111,7 @@ describe Bigbluebutton::RoomsController do
|
|
111
111
|
|
112
112
|
context "room is not running" do
|
113
113
|
before { mocked_api.should_receive(:is_meeting_running?).and_return(false) }
|
114
|
-
before(:each) { get :end, :id => room.to_param, :format => 'json' }
|
114
|
+
before(:each) { get :end, :server_id => mocked_server.to_param, :id => room.to_param, :format => 'json' }
|
115
115
|
it { should respond_with(:error) }
|
116
116
|
it { should respond_with_content_type(:json) }
|
117
117
|
it { should respond_with_json(I18n.t('bigbluebutton_rails.rooms.notice.end.not_running')) }
|
@@ -122,7 +122,7 @@ describe Bigbluebutton::RoomsController do
|
|
122
122
|
before {
|
123
123
|
mocked_api.should_receive(:is_meeting_running?).and_return{ raise BigBlueButton::BigBlueButtonException.new(msg) }
|
124
124
|
}
|
125
|
-
before(:each) { get :end, :id => room.to_param, :format => 'json' }
|
125
|
+
before(:each) { get :end, :server_id => mocked_server.to_param, :id => room.to_param, :format => 'json' }
|
126
126
|
it { should respond_with(:error) }
|
127
127
|
it { should respond_with_content_type(:json) }
|
128
128
|
it { should respond_with_json(msg) }
|
@@ -139,7 +139,7 @@ describe Bigbluebutton::RoomsController do
|
|
139
139
|
mocked_api.should_receive(:end_meeting)
|
140
140
|
}
|
141
141
|
before(:each) {
|
142
|
-
delete :destroy, :id => room.to_param, :format => 'json'
|
142
|
+
delete :destroy, :server_id => mocked_server.to_param, :id => room.to_param, :format => 'json'
|
143
143
|
}
|
144
144
|
it { should respond_with(:success) }
|
145
145
|
it { should respond_with_content_type(:json) }
|
@@ -155,7 +155,7 @@ describe Bigbluebutton::RoomsController do
|
|
155
155
|
mocked_api.should_receive(:is_meeting_running?).and_return{ raise BigBlueButton::BigBlueButtonException.new(msg) }
|
156
156
|
}
|
157
157
|
before(:each) {
|
158
|
-
delete :destroy, :id => room.to_param, :format => 'json'
|
158
|
+
delete :destroy, :server_id => mocked_server.to_param, :id => room.to_param, :format => 'json'
|
159
159
|
}
|
160
160
|
it { should respond_with(:error) }
|
161
161
|
it { should respond_with_content_type(:json) }
|