bigbluebutton_rails 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,6 +1,6 @@
|
|
1
1
|
<h1>Edit <%= BigbluebuttonRoom.model_name.human %>:</h1>
|
2
2
|
<%= render 'form' %>
|
3
3
|
|
4
|
-
<%= link_to 'Show',
|
5
|
-
<%= link_to 'Back',
|
4
|
+
<%= link_to 'Show', bigbluebutton_room_path(@room) %> |
|
5
|
+
<%= link_to 'Back', bigbluebutton_rooms_path %>
|
6
6
|
|
@@ -4,7 +4,8 @@
|
|
4
4
|
|
5
5
|
<p>This meeting was created from another application.<br/>You must provide a name and a password to join:</p>
|
6
6
|
|
7
|
-
<%= form_tag
|
7
|
+
<%= form_tag external_bigbluebutton_rooms_path do %>
|
8
|
+
<%= hidden_field_tag "server_id", params[:server_id] %>
|
8
9
|
<%= hidden_field_tag "meeting", params[:meeting] %>
|
9
10
|
|
10
11
|
<div class="field">
|
@@ -1,37 +1,2 @@
|
|
1
|
-
<h1>Listing
|
2
|
-
|
3
|
-
<div id="bbbrails_rooms_links">
|
4
|
-
<%= link_to 'Back to server', bigbluebutton_server_path(@server) %> |
|
5
|
-
<%= link_to 'Back to server list', bigbluebutton_servers_path %><br/>
|
6
|
-
<%= link_to 'New room', new_bigbluebutton_server_room_path %>
|
7
|
-
</div>
|
8
|
-
|
9
|
-
<ul id="bbbrails_rooms_list">
|
10
|
-
<% @rooms.each do |room| %>
|
11
|
-
<li>
|
12
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:server_id) %></label> <%= room.server_id %></div>
|
13
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:meetingid) %></label> <%= room.meetingid %></div>
|
14
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:randomize_meetingid) %></label> <%= room.randomize_meetingid %></div>
|
15
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:name) %></label> <%= room.name %></div>
|
16
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:private) %></label> <%= room.private %></div>
|
17
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:attendee_password) %></label> <%= room.attendee_password %></div>
|
18
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:moderator_password) %></label> <%= room.moderator_password %></div>
|
19
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:welcome_msg) %></label> <%= room.welcome_msg %></div>
|
20
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:logout_url) %></label> <%= room.logout_url %></div>
|
21
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:dial_number) %></label> <%= room.dial_number %></div>
|
22
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:voice_bridge) %></label> <%= room.voice_bridge %></div>
|
23
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:max_participants) %></label> <%= room.max_participants %></div>
|
24
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:external) %></label> <%= room.external %></div>
|
25
|
-
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:param) %></label> <%= room.param %></div>
|
26
|
-
<div class="field"><label>Access</label>
|
27
|
-
<%= link_to 'Show', bigbluebutton_server_room_path(@server, room) %> |
|
28
|
-
<%= link_to 'Join', join_bigbluebutton_server_room_path(@server, room) %> |
|
29
|
-
<%= link_to 'Invite', invite_bigbluebutton_server_room_path(@server, room) %> |
|
30
|
-
<%= link_to 'Mobile Join', join_mobile_bigbluebutton_server_room_path(@server, room) %> |
|
31
|
-
<%= link_to 'Edit', edit_bigbluebutton_server_room_path(@server, room) %> |
|
32
|
-
<%= link_to 'End', end_bigbluebutton_server_room_path(@server, room), :confirm => 'Are you sure?' %> |
|
33
|
-
<%= link_to 'Destroy', bigbluebutton_server_room_path(@server, room), :confirm => 'Are you sure?', :method => :delete %>
|
34
|
-
</div>
|
35
|
-
</li>
|
36
|
-
<% end %>
|
37
|
-
</ul>
|
1
|
+
<h1>Listing rooms:</h1>
|
2
|
+
<%= render 'rooms' %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
function ajax_request() {
|
4
4
|
$.ajax({
|
5
|
-
url: "<%=
|
5
|
+
url: "<%= running_bigbluebutton_room_url(@room, :format => 'json') %>",
|
6
6
|
dataType: 'json',
|
7
7
|
error: function(xhr_data) {
|
8
8
|
$("#meeting_status").html("<request error>.");
|
@@ -33,7 +33,7 @@ $(document).ready(function(){
|
|
33
33
|
<p>Meeting status: <span id="meeting_status">-</span> (<a href="javascript:ajax_request();">refresh</a>)</p>
|
34
34
|
<p><%= @room.name %> requires a name and/or password to join:</p>
|
35
35
|
|
36
|
-
<%= form_tag
|
36
|
+
<%= form_tag join_bigbluebutton_room_path(@room) do %>
|
37
37
|
|
38
38
|
<div class="field">
|
39
39
|
<label for="user_name">Name:</label><br />
|
@@ -8,7 +8,7 @@
|
|
8
8
|
</p>
|
9
9
|
<p>
|
10
10
|
<b><%= BigbluebuttonRoom.human_attribute_name(:server_id) %>:</b>
|
11
|
-
<%= @room.
|
11
|
+
<%= @room.server_id %>
|
12
12
|
</p>
|
13
13
|
<p>
|
14
14
|
<b><%= BigbluebuttonRoom.human_attribute_name(:meetingid) %>:</b>
|
@@ -59,9 +59,15 @@
|
|
59
59
|
<%= @room.param %>
|
60
60
|
</p>
|
61
61
|
|
62
|
-
<%= link_to 'Edit',
|
63
|
-
<%= link_to 'Back',
|
62
|
+
<%= link_to 'Edit', edit_bigbluebutton_room_path(@room) %> |
|
63
|
+
<%= link_to 'Back', bigbluebutton_rooms_path %>
|
64
64
|
|
65
65
|
<br/>
|
66
66
|
|
67
|
-
|
67
|
+
<span>Access:</span>
|
68
|
+
<%= link_to 'Show', bigbluebutton_room_path(@room) %> |
|
69
|
+
<%= link_to 'Join', join_bigbluebutton_room_path(@room) %> |
|
70
|
+
<%= link_to 'Invite', invite_bigbluebutton_room_path(@room) %> |
|
71
|
+
<%= link_to 'Mobile Join', join_mobile_bigbluebutton_room_path(@room) %> |
|
72
|
+
<%= link_to 'End', end_bigbluebutton_room_path(@room), :confirm => 'Are you sure?' %> |
|
73
|
+
<%= link_to 'Destroy', bigbluebutton_room_path(@room), :confirm => 'Are you sure?', :method => :delete %>
|
@@ -3,14 +3,14 @@
|
|
3
3
|
<div class="title_bar">
|
4
4
|
<% unless room.new_record? %>
|
5
5
|
<div class="button_bar">
|
6
|
-
<%= link_to 'Show',
|
7
|
-
<%= link_to 'Edit',
|
8
|
-
<%= link_to 'Destroy',
|
6
|
+
<%= link_to 'Show', bigbluebutton_room_path(room) %>
|
7
|
+
<%= link_to 'Edit', edit_bigbluebutton_room_path(room) %>
|
8
|
+
<%= link_to 'Destroy', bigbluebutton_room_path(room), :confirm => 'Are you sure?', :method => :delete %>
|
9
9
|
</div>
|
10
10
|
<div class="button_bar">
|
11
|
-
<%= link_to 'Join',
|
12
|
-
<%= link_to 'Mobile Join',
|
13
|
-
<%= link_to 'End',
|
11
|
+
<%= link_to 'Join', join_bigbluebutton_room_path(room) %>
|
12
|
+
<%= link_to 'Mobile Join', join_mobile_bigbluebutton_room_path(room) %>
|
13
|
+
<%= link_to 'End', end_bigbluebutton_room_path(room), :confirm => 'Are you sure?' %>
|
14
14
|
</div>
|
15
15
|
<% end %>
|
16
16
|
<b><%= room.name %></b> (ID: <%= room.meetingid %>) -
|
@@ -1,7 +1,8 @@
|
|
1
1
|
<h1>Listing <%= BigbluebuttonServer.model_name.human %>:</h1>
|
2
2
|
|
3
3
|
<div id="bbbrails_servers_links">
|
4
|
-
<%= link_to
|
4
|
+
<%= link_to('View rooms list', bigbluebutton_rooms_path) %><br/>
|
5
|
+
<%= link_to('New server', new_bigbluebutton_server_path) %>
|
5
6
|
</div>
|
6
7
|
|
7
8
|
<ul id="bbbrails_servers_list">
|
@@ -14,10 +15,10 @@
|
|
14
15
|
<div><label><%= BigbluebuttonServer.human_attribute_name(:param) %></label> <%= server.param %></div>
|
15
16
|
<div><label>Access</label>
|
16
17
|
<%= link_to 'Show', server %> |
|
17
|
-
<%= link_to 'View rooms',
|
18
|
+
<%= link_to 'View rooms', rooms_bigbluebutton_server_path(server) %> |
|
18
19
|
<%= link_to 'Activity monitor', activity_bigbluebutton_server_path(server) %> |
|
19
20
|
<%= link_to 'Edit', edit_bigbluebutton_server_path(server) %> |
|
20
|
-
<%= link_to 'Destroy', server, :confirm => 'Are you sure?', :method => :delete %>
|
21
|
+
<%= link_to 'Destroy', bigbluebutton_server_path(server), :confirm => 'Are you sure?', :method => :delete %>
|
21
22
|
</div>
|
22
23
|
</li>
|
23
24
|
<% end %>
|
@@ -29,8 +29,7 @@
|
|
29
29
|
|
30
30
|
|
31
31
|
<%= link_to 'Edit', edit_bigbluebutton_server_path(@server) %> |
|
32
|
+
<%= link_to 'View rooms', rooms_bigbluebutton_server_path(@server) %> |
|
33
|
+
<%= link_to 'Activity monitor', activity_bigbluebutton_server_path(@server) %> |
|
34
|
+
<%= link_to 'Destroy', bigbluebutton_server_path(@server), :confirm => 'Are you sure?', :method => :delete %> |
|
32
35
|
<%= link_to 'Back', bigbluebutton_servers_path %>
|
33
|
-
|
34
|
-
<br/>
|
35
|
-
|
36
|
-
<%= link_to 'New room', new_bigbluebutton_server_room_path(@server) %>
|
data/config/locales/en.yml
CHANGED
@@ -27,10 +27,14 @@ en:
|
|
27
27
|
auth:
|
28
28
|
failure: "Authentication failure."
|
29
29
|
not_running: "The meeting is not running. You must wait for a moderator to join."
|
30
|
-
wrong_params: "Wrong
|
30
|
+
wrong_params: "Wrong parameters in your request."
|
31
31
|
external:
|
32
|
-
blank_meetingid: "You must specify the meetingid of the meeting you want to join"
|
33
|
-
|
32
|
+
blank_meetingid: "You must specify the meetingid of the meeting you want to join."
|
33
|
+
inexistent_meeting: "The meeting informed does not exists in the server."
|
34
|
+
wrong_params: "Wrong parameters in your request."
|
35
|
+
param_format: 'you can only use letters, numbers and the symbols "-" or "_" (not at the begin or end).'
|
36
|
+
server:
|
37
|
+
not_set: "Your room must be associated to a server to execute this operation."
|
34
38
|
|
35
39
|
activerecord:
|
36
40
|
models:
|
@@ -3,4 +3,8 @@ 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
|
+
|
6
10
|
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 the other available actions for servers and rooms.
|
17
17
|
#
|
18
18
|
# bigbluebutton_routes :default
|
19
19
|
#
|
20
|
-
#
|
20
|
+
# Examples of 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_room GET /bigbluebutton/rooms/:id/join(.:format)
|
27
27
|
# { :action=>"join", :controller=>"bigbluebutton/rooms" }
|
28
|
-
#
|
28
|
+
# running_bigbluebutton_room GET /bigbluebutton/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 they are scoped (namespaced) with 'bigbluebutton'. You can change the namespace with:
|
33
33
|
#
|
34
34
|
# bigbluebutton_routes :default, :scope => "webconference"
|
35
35
|
#
|
@@ -40,7 +40,8 @@ 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
|
-
#
|
43
|
+
# Rooms can belong to users, communities or any other type of "entity" in an aplication.
|
44
|
+
# This helper creates routes to the all the actions available in Bigbluebutton::RoomsController.
|
44
45
|
#
|
45
46
|
# bigbluebutton_routes :room_matchers
|
46
47
|
#
|
@@ -50,18 +51,12 @@ module ActionDispatch::Routing
|
|
50
51
|
# bigbluebutton_routes :room_matchers
|
51
52
|
# end
|
52
53
|
#
|
53
|
-
#
|
54
|
+
# Examples of some routes generated:
|
54
55
|
#
|
55
56
|
# user_room GET /users/:user_id/room/:id(.:format)
|
56
57
|
# { :controller=>"bigbluebutton/rooms", :action=>"show" }
|
57
58
|
# user_join_room GET /users/:user_id/room/:id/join(.:format)
|
58
59
|
# { :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" }
|
65
60
|
# user_end_room GET /users/:user_id/room/:id/end(.:format)
|
66
61
|
# { :controller=>"bigbluebutton/rooms", :action=>"end" }
|
67
62
|
# user_invite_room GET /users/:user_id/room/:id/invite(.:format)
|
@@ -82,33 +77,31 @@ module ActionDispatch::Routing
|
|
82
77
|
scope options_scope, :as => options_scope do
|
83
78
|
resources :servers, :controller => BigbluebuttonRails.controllers[:servers] do
|
84
79
|
get :activity, :on => :member
|
85
|
-
|
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
|
80
|
+
get :rooms, :on => :member
|
99
81
|
end
|
82
|
+
add_routes_for_rooms
|
100
83
|
end
|
101
84
|
end
|
102
85
|
|
103
86
|
def bigbluebutton_routes_room_matchers(*params) #:nodoc:
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
87
|
+
add_routes_for_rooms
|
88
|
+
end
|
89
|
+
|
90
|
+
def add_routes_for_rooms
|
91
|
+
resources :rooms, :controller => BigbluebuttonRails.controllers[:rooms] do
|
92
|
+
collection do
|
93
|
+
get :external
|
94
|
+
post :external, :action => :external_auth
|
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
|
112
105
|
end
|
113
106
|
|
114
107
|
end
|
@@ -2,14 +2,13 @@ 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) }
|
7
5
|
|
8
6
|
# make sure that the exceptions thrown by bigbluebutton-api-ruby are treated by the controller
|
9
7
|
context "exception handling" do
|
10
8
|
let(:bbb_error_msg) { "err msg" }
|
11
9
|
let(:bbb_error) { BigBlueButton::BigBlueButtonException.new(bbb_error_msg) }
|
12
10
|
let(:http_referer) { bigbluebutton_server_path(mocked_server) }
|
11
|
+
let(:room) { Factory.create(:bigbluebutton_room, :server => mocked_server) }
|
13
12
|
before {
|
14
13
|
mock_server_and_api
|
15
14
|
request.env["HTTP_REFERER"] = http_referer
|
@@ -26,16 +25,16 @@ describe Bigbluebutton::RoomsController do
|
|
26
25
|
end
|
27
26
|
|
28
27
|
after :each do
|
29
|
-
delete :destroy, :
|
28
|
+
delete :destroy, :id => room.to_param
|
30
29
|
should respond_with(:redirect)
|
31
|
-
should redirect_to
|
30
|
+
should redirect_to bigbluebutton_rooms_url
|
32
31
|
should set_the_flash.to(bbb_error_msg)
|
33
32
|
end
|
34
33
|
end
|
35
34
|
|
36
35
|
describe "#running" do
|
37
36
|
before { mocked_api.should_receive(:is_meeting_running?) { raise bbb_error } }
|
38
|
-
before(:each) { get :running, :
|
37
|
+
before(:each) { get :running, :id => room.to_param }
|
39
38
|
it { should respond_with(:success) }
|
40
39
|
it { response.body.should == build_running_json(false, bbb_error_msg) }
|
41
40
|
it { should set_the_flash.to(bbb_error_msg) }
|
@@ -52,7 +51,7 @@ describe Bigbluebutton::RoomsController do
|
|
52
51
|
end
|
53
52
|
|
54
53
|
after :each do
|
55
|
-
get :end, :
|
54
|
+
get :end, :id => room.to_param
|
56
55
|
should respond_with(:redirect)
|
57
56
|
should redirect_to(http_referer)
|
58
57
|
should set_the_flash.to(bbb_error_msg)
|
@@ -63,7 +62,11 @@ describe Bigbluebutton::RoomsController do
|
|
63
62
|
before { controller.stub(:bigbluebutton_user) { Factory.build(:user) } }
|
64
63
|
|
65
64
|
context "as moderator" do
|
66
|
-
before {
|
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
|
+
}
|
67
70
|
|
68
71
|
it "catches exception on is_meeting_running" do
|
69
72
|
mocked_api.should_receive(:is_meeting_running?) { raise bbb_error }
|
@@ -80,7 +83,7 @@ describe Bigbluebutton::RoomsController do
|
|
80
83
|
end
|
81
84
|
|
82
85
|
after :each do
|
83
|
-
get :join, :
|
86
|
+
get :join, :id => room.to_param
|
84
87
|
should respond_with(:redirect)
|
85
88
|
should redirect_to(http_referer)
|
86
89
|
should set_the_flash.to(bbb_error_msg)
|
@@ -88,7 +91,7 @@ describe Bigbluebutton::RoomsController do
|
|
88
91
|
|
89
92
|
end
|
90
93
|
|
91
|
-
context "as
|
94
|
+
context "as attendee" do
|
92
95
|
before { controller.should_receive(:bigbluebutton_role).with(room).and_return(:attendee) }
|
93
96
|
|
94
97
|
it "catches exception on is_meeting_running" do
|
@@ -101,7 +104,7 @@ describe Bigbluebutton::RoomsController do
|
|
101
104
|
end
|
102
105
|
|
103
106
|
after :each do
|
104
|
-
get :join, :
|
107
|
+
get :join, :id => room.to_param
|
105
108
|
should respond_with(:redirect)
|
106
109
|
should redirect_to(http_referer)
|
107
110
|
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
|
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, :
|
15
|
+
before(:each) { get :index, :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, :
|
22
|
+
before(:each) { get :new, :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, :
|
33
|
+
before(:each) { get :show, :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, :
|
44
|
+
post :create, :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, :
|
57
|
+
post :create, :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, :
|
74
|
+
put :update, :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, :
|
87
|
+
put :update, :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, :
|
106
|
+
before(:each) { get :end, :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, :
|
114
|
+
before(:each) { get :end, :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, :
|
125
|
+
before(:each) { get :end, :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, :
|
142
|
+
delete :destroy, :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, :
|
158
|
+
delete :destroy, :id => room.to_param, :format => 'json'
|
159
159
|
}
|
160
160
|
it { should respond_with(:error) }
|
161
161
|
it { should respond_with_content_type(:json) }
|