bigbluebutton_rails 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/CHANGELOG.rdoc +1 -12
  2. data/Gemfile.lock +1 -1
  3. data/README.rdoc +32 -46
  4. data/Rakefile +1 -0
  5. data/app/controllers/bigbluebutton/rooms_controller.rb +16 -17
  6. data/app/controllers/bigbluebutton/servers_controller.rb +2 -6
  7. data/app/models/bigbluebutton_room.rb +1 -35
  8. data/app/models/bigbluebutton_server.rb +1 -1
  9. data/app/views/bigbluebutton/rooms/_form.html.erb +3 -7
  10. data/app/views/bigbluebutton/rooms/edit.html.erb +2 -2
  11. data/app/views/bigbluebutton/rooms/external.html.erb +1 -2
  12. data/app/views/bigbluebutton/rooms/index.html.erb +37 -2
  13. data/app/views/bigbluebutton/rooms/invite.html.erb +2 -2
  14. data/app/views/bigbluebutton/rooms/join.html.erb +1 -1
  15. data/app/views/bigbluebutton/rooms/new.html.erb +1 -1
  16. data/app/views/bigbluebutton/rooms/show.html.erb +4 -10
  17. data/app/views/bigbluebutton/servers/_activity_list.html.erb +6 -6
  18. data/app/views/bigbluebutton/servers/index.html.erb +3 -4
  19. data/app/views/bigbluebutton/servers/show.html.erb +4 -3
  20. data/config/locales/en.yml +3 -7
  21. data/lib/bigbluebutton_rails/exceptions.rb +0 -4
  22. data/lib/bigbluebutton_rails/rails/routes.rb +35 -28
  23. data/lib/bigbluebutton_rails/version.rb +1 -1
  24. data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +10 -13
  25. data/spec/controllers/bigbluebutton/rooms_controller_json_responses_spec.rb +13 -13
  26. data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +115 -114
  27. data/spec/controllers/bigbluebutton/servers_controller_json_responses_spec.rb +1 -12
  28. data/spec/controllers/bigbluebutton/servers_controller_spec.rb +0 -11
  29. data/spec/generators/install_generator_spec.rb +1 -1
  30. data/spec/models/bigbluebutton_room_spec.rb +80 -166
  31. data/spec/models/bigbluebutton_server_spec.rb +4 -4
  32. data/spec/rails_app/features/activity_monitor_servers.feature +0 -6
  33. data/spec/rails_app/features/create_rooms.feature +0 -5
  34. data/spec/rails_app/features/create_servers.feature +2 -7
  35. data/spec/rails_app/features/edit_rooms.feature +0 -7
  36. data/spec/rails_app/features/edit_servers.feature +2 -8
  37. data/spec/rails_app/features/join_rooms.feature +0 -1
  38. data/spec/rails_app/features/list_and_show_rooms.feature +2 -10
  39. data/spec/rails_app/features/step_definitions/activity_monitor_servers_step.rb +10 -10
  40. data/spec/rails_app/features/step_definitions/common_steps.rb +4 -6
  41. data/spec/rails_app/features/step_definitions/create_rooms_steps.rb +0 -1
  42. data/spec/rails_app/features/step_definitions/join_mobile_steps.rb +3 -1
  43. data/spec/rails_app/features/step_definitions/join_rooms_steps.rb +7 -3
  44. data/spec/rails_app/features/step_definitions/list_and_show_rooms_steps.rb +5 -12
  45. data/spec/rails_app/features/step_definitions/list_and_show_servers_steps.rb +5 -1
  46. data/spec/rails_app/features/support/{patches/application_controller.rb → application_controller.rb} +0 -0
  47. data/spec/rails_app/features/support/paths.rb +10 -12
  48. data/spec/rails_app/features/support/templates.rb +46 -90
  49. data/spec/routing/bigbluebutton/custom_controllers_routing_spec.rb +22 -38
  50. data/spec/routing/bigbluebutton/rooms_routing_spec.rb +58 -142
  51. data/spec/routing/bigbluebutton/servers_routing_spec.rb +1 -9
  52. metadata +9 -12
  53. data/app/views/bigbluebutton/rooms/_rooms.html.erb +0 -37
  54. data/app/views/bigbluebutton/servers/rooms.html.erb +0 -2
  55. data/spec/rails_app/features/support/patches/bigbluebutton_room.rb +0 -9
@@ -6,7 +6,7 @@ module NavigationHelpers
6
6
  # step definition in web_steps.rb
7
7
  #
8
8
  def path_to(page_name, params=nil)
9
- params = "?" + params.map{ |k,v| "#{k}=#{CGI::escape(v.to_s)}" }.join("&") if params
9
+ params = "?" + params.map{ |k,v| "#{k}=#{CGI::escape(v)}" }.join("&") if params
10
10
 
11
11
  case page_name
12
12
 
@@ -24,26 +24,24 @@ module NavigationHelpers
24
24
  p = bigbluebutton_server_path(@server)
25
25
  when /server activity monitor/i
26
26
  p = activity_bigbluebutton_server_path(@server)
27
- when /server rooms/i
28
- p = rooms_bigbluebutton_server_path(@server)
29
27
  when /new room/i
30
- p = new_bigbluebutton_room_path
28
+ p = new_bigbluebutton_server_room_path(@server)
31
29
  when /rooms index/i, /create room/i
32
- p = bigbluebutton_rooms_path
30
+ p = bigbluebutton_server_rooms_path(@server)
33
31
  when /join external room/i
34
- p = external_bigbluebutton_rooms_path
32
+ p = external_bigbluebutton_server_rooms_path(@server)
35
33
  when /show room/i
36
- p = bigbluebutton_room_path(@room)
34
+ p = bigbluebutton_server_room_path(@server, @room)
37
35
  when /edit room/i
38
- p = edit_bigbluebutton_room_path(@room)
36
+ p = edit_bigbluebutton_server_room_path(@server, @room)
39
37
  when /update room/i
40
- p = bigbluebutton_room_path(@room)
38
+ p = bigbluebutton_server_room_path(@server, @room)
41
39
  when /join room/i
42
- p = join_bigbluebutton_room_path(@room)
40
+ p = join_bigbluebutton_server_room_path(@server, @room)
43
41
  when /invite room/i
44
- p = invite_bigbluebutton_room_path(@room)
42
+ p = invite_bigbluebutton_server_room_path(@server, @room)
45
43
  when /mobile join/i
46
- p = join_mobile_bigbluebutton_room_path(@room)
44
+ p = join_mobile_bigbluebutton_server_room_path(@server, @room)
47
45
 
48
46
  else
49
47
  begin
@@ -2,27 +2,26 @@
2
2
  module TemplateHelpers
3
3
 
4
4
  # calls the specific methods that verify the template for each page
5
- def check_template(page_name, options={})
6
- method = ("check " + page_name).split(" ").join('_').to_sym
7
- unless self.respond_to?(method)
5
+ def check_template(page_name)
6
+ begin
7
+ method = ("check " + page_name).split(" ").join('_').to_sym
8
+ self.send(method)
9
+ rescue NoMethodError
8
10
  raise "Can't find method to check the template for \"#{page_name}\"\n" +
9
- "Now, go and add the method \"#{method}(options)\" in #{__FILE__}"
11
+ "Now, go and add the method \"#{method}\" in #{__FILE__}"
10
12
  end
11
- self.send(method, options)
12
13
  end
13
14
 
14
15
  # servers/new
15
- def check_new_server(options)
16
+ def check_new_server
16
17
  within(form_selector(bigbluebutton_servers_path, 'post')) do
17
18
  check_server_form
18
19
  end
19
20
  end
20
21
 
21
22
  # server/:id/edit
22
- def check_edit_server(options)
23
- server = options[:server] || BigbluebuttonServer.last
24
-
25
- within(form_selector(bigbluebutton_server_path(server), 'post')) do
23
+ def check_edit_server
24
+ within(form_selector(bigbluebutton_server_path(@server), 'post')) do
26
25
  check_server_form
27
26
  end
28
27
  end
@@ -47,29 +46,29 @@ module TemplateHelpers
47
46
  has_element("input", { :name => 'commit', :type => 'submit' })
48
47
  end
49
48
 
50
- # server/:id/show
51
- def check_show_server(options)
52
- server = options[:server] || BigbluebuttonServer.last
49
+ # servers/new
50
+ def check_new_room
51
+ within(form_selector(bigbluebutton_server_rooms_path(@server), 'post')) do
52
+ check_room_form
53
+ end
54
+ end
53
55
 
56
+ # server/:id/show
57
+ def check_show_server
58
+ server = BigbluebuttonServer.last
54
59
  page_has_content(server.name)
55
60
  page_has_content(server.url)
56
61
  page_has_content(server.salt)
57
62
  page_has_content(server.version)
58
63
  page_has_content(server.param)
59
- has_element("a", { :href => edit_bigbluebutton_server_path(server) }) # edit
60
- has_element("a", { :href => activity_bigbluebutton_server_path(server) }) # activity
61
- has_element("a", { :href => rooms_bigbluebutton_server_path(server) }) # rooms
62
- has_element("a", { :href => bigbluebutton_server_path(server), :"data-method" => 'delete' }) # destroy
64
+ has_element("a", { :href => new_bigbluebutton_server_room_path(server) }) # new room link
63
65
  end
64
66
 
65
67
  # servers/
66
- def check_servers_index(options)
67
- servers = options[:severs] || BigbluebuttonServer.all
68
-
68
+ def check_servers_index
69
69
  has_element("a", { :href => new_bigbluebutton_server_path }) # new server link
70
- has_element("a", { :href => bigbluebutton_rooms_path }) # rooms list
71
70
  n = 1
72
- servers.each do |server|
71
+ BigbluebuttonServer.all.each do |server|
73
72
  within(make_selector("ul#bbbrails_servers_list>li:nth(#{n})")) do
74
73
  # server data
75
74
  has_content(server.name)
@@ -80,7 +79,7 @@ module TemplateHelpers
80
79
  has_content(server.url)
81
80
  # action links
82
81
  has_element("a", { :href => bigbluebutton_server_path(server) }) # show
83
- has_element("a", { :href => rooms_bigbluebutton_server_path(server) }) # rooms
82
+ has_element("a", { :href => bigbluebutton_server_rooms_path(server) }) # index
84
83
  has_element("a", { :href => activity_bigbluebutton_server_path(server) }) # activity
85
84
  has_element("a", { :href => edit_bigbluebutton_server_path(server) }) # edit
86
85
  has_element("a", { :href => bigbluebutton_server_path(server), :"data-method" => 'delete' }) # destroy
@@ -90,47 +89,28 @@ module TemplateHelpers
90
89
  end
91
90
 
92
91
  # servers/:id/activity
93
- def check_server_activity_monitor(options)
94
- server = options[:server] || BigbluebuttonServer.last
95
-
92
+ def check_server_activity_monitor
96
93
  # checks only the 'skeleton', the content depends on the rooms currently running
97
- # and is not checked here
98
94
  within(make_selector("div.bbbrails_countdown")) do
99
95
  has_element("span.bbbrails_countdown_value")
100
96
  has_element("a.bbbrails_refresh_now",
101
- { :href => activity_bigbluebutton_server_path(server) })
97
+ { :href => activity_bigbluebutton_server_path(@server) })
102
98
  end
103
99
  has_element("div#bbbrails_server_activity_meetings")
104
100
  end
105
101
 
106
- # servers/:id/rooms
107
- def check_server_rooms(options)
108
- check_rooms_index(options)
109
- end
110
-
111
102
 
112
103
 
113
104
 
114
- # rooms/new
115
- def check_new_room(options)
116
- within(form_selector(bigbluebutton_rooms_path, 'post')) do
117
- check_room_form
118
- end
119
- end
120
-
121
105
  # room/:id/edit
122
- def check_edit_room(options)
123
- room = options[:room] || BigbluebuttonRoom.last
124
-
125
- within(form_selector(bigbluebutton_room_path(room), 'post')) do
106
+ def check_edit_room
107
+ within(form_selector(bigbluebutton_server_room_path(@server, @room), 'post')) do
126
108
  check_room_form
127
109
  end
128
110
  end
129
111
 
130
112
  # internal form in rooms/new and room/:id/edit
131
113
  def check_room_form
132
- has_element("input#bigbluebutton_room_server_id",
133
- { :name => 'bigbluebutton_room[server_id]', :type => 'text' })
134
114
  has_element("input#bigbluebutton_room_name",
135
115
  { :name => 'bigbluebutton_room[name]', :type => 'text' })
136
116
  has_element("input#bigbluebutton_room_meetingid",
@@ -174,10 +154,8 @@ module TemplateHelpers
174
154
  end
175
155
 
176
156
  # room/:id/show
177
- def check_show_room(options)
178
- room = options[:room] || BigbluebuttonRoom.last
179
-
180
- page_has_content(room.server_id)
157
+ def check_show_room
158
+ room = BigbluebuttonRoom.last
181
159
  page_has_content(room.name)
182
160
  page_has_content(room.meetingid)
183
161
  page_has_content(room.randomize_meetingid)
@@ -191,23 +169,12 @@ module TemplateHelpers
191
169
  page_has_content(room.max_participants)
192
170
  page_has_content(room.external)
193
171
  page_has_content(room.param)
194
- # action links
195
- has_element("a", { :href => edit_bigbluebutton_room_path(room) }) # edit
196
- has_element("a", { :href => bigbluebutton_room_path(room) }) # show
197
- has_element("a", { :href => join_bigbluebutton_room_path(room) }) # join
198
- has_element("a", { :href => invite_bigbluebutton_room_path(room) }) # invite
199
- has_element("a", { :href => join_mobile_bigbluebutton_room_path(room) }) # join_mobile
200
- has_element("a", { :href => end_bigbluebutton_room_path(room) }) # end
201
- has_element("a", { :href => bigbluebutton_room_path(room), :"data-method" => 'delete' }) # destroy
202
172
  end
203
173
 
204
174
  # rooms/external
205
- def check_join_external_room(options)
206
- room = options[:room] || BigbluebuttonRoom.last
207
-
208
- within(form_selector(external_bigbluebutton_rooms_path, 'post')) do
209
- has_element("input#server_id", { :name => 'server_id', :type => 'hidden', :value => room.server_id })
210
- has_element("input#meeting", { :name => 'meeting', :type => 'hidden', :value => room.meetingid })
175
+ def check_join_external_room
176
+ within(form_selector(external_bigbluebutton_server_rooms_path(@server), 'post')) do
177
+ has_element("input#meeting", { :name => 'meeting', :type => 'hidden', :value => @room.meetingid })
211
178
  has_element("input#user_name", { :name => 'user[name]', :type => 'text' })
212
179
  has_element("input#user_password", { :name => 'user[password]', :type => 'password' })
213
180
  has_element("label", { :for => 'user_name' })
@@ -217,10 +184,8 @@ module TemplateHelpers
217
184
  end
218
185
 
219
186
  # rooms/:id/invite
220
- def check_invite_room(options)
221
- room = options[:room] || BigbluebuttonRoom.last
222
-
223
- within(form_selector(join_bigbluebutton_room_path(room), 'post')) do
187
+ def check_invite_room
188
+ within(form_selector(join_bigbluebutton_server_room_path(@server, @room), 'post')) do
224
189
  has_element("input#user_name", { :name => 'user[name]', :type => 'text' })
225
190
  has_element("input#user_password", { :name => 'user[password]', :type => 'password' })
226
191
  has_element("label", { :for => 'user_name' })
@@ -230,16 +195,12 @@ module TemplateHelpers
230
195
  end
231
196
 
232
197
  # rooms/
233
- def check_rooms_index(options)
234
- rooms = options[:rooms] || BigbluebuttonRoom.all
235
-
236
- has_element("a", { :href => new_bigbluebutton_room_path }) # new room link
237
- has_element("a", { :href => bigbluebutton_servers_path }) # servers list
198
+ def check_rooms_index
199
+ has_element("a", { :href => new_bigbluebutton_server_room_path(@server) }) # new room link
238
200
  n = 1
239
- rooms.each do |room|
201
+ BigbluebuttonRoom.all.each do |room|
240
202
  within(make_selector("ul#bbbrails_rooms_list>li:nth(#{n})")) do
241
203
  # room data
242
- has_content(room.server_id) unless room.server.nil?
243
204
  has_content(room.name)
244
205
  has_content(room.meetingid)
245
206
  has_content(room.attendee_password)
@@ -249,29 +210,24 @@ module TemplateHelpers
249
210
  has_content(room.voice_bridge)
250
211
  has_content(room.param)
251
212
  # action links
252
- unless room.server.nil?
253
- has_element("a", { :href => bigbluebutton_server_path(room.server) }) # show server
254
- end
255
- has_element("a", { :href => bigbluebutton_room_path(room) }) # show
256
- has_element("a", { :href => join_bigbluebutton_room_path(room) }) # join
257
- has_element("a", { :href => invite_bigbluebutton_room_path(room) }) # invite
258
- has_element("a", { :href => join_mobile_bigbluebutton_room_path(room) }) # join_mobile
259
- has_element("a", { :href => edit_bigbluebutton_room_path(room) }) # edit
260
- has_element("a", { :href => end_bigbluebutton_room_path(room) }) # end
261
- has_element("a", { :href => bigbluebutton_room_path(room), :"data-method" => 'delete' }) # destroy
213
+ has_element("a", { :href => bigbluebutton_server_room_path(@server, room) }) # show
214
+ has_element("a", { :href => join_bigbluebutton_server_room_path(@server, room) }) # join
215
+ has_element("a", { :href => invite_bigbluebutton_server_room_path(@server, room) }) # invite
216
+ has_element("a", { :href => join_mobile_bigbluebutton_server_room_path(@server, room) }) # join_mobile
217
+ has_element("a", { :href => edit_bigbluebutton_server_room_path(@server, room) }) # edit
218
+ has_element("a", { :href => end_bigbluebutton_server_room_path(@server, room) }) # end
219
+ has_element("a", { :href => bigbluebutton_server_room_path(@server, room), :"data-method" => 'delete' }) # destroy
262
220
  end
263
221
  n += 1
264
222
  end
265
223
  end
266
224
 
267
- def check_join_room(options) # nothing to check, it only redirects to the BBB client
225
+ def check_join_room # nothing to check, it only redirects to the BBB client
268
226
  end
269
227
 
270
228
  # rooms/:id/join_mobile
271
- def check_mobile_join(options)
272
- room = options[:room] || BigbluebuttonRoom.last
273
-
274
- url = join_bigbluebutton_room_url(room, :mobile => '1')
229
+ def check_mobile_join
230
+ url = join_bigbluebutton_server_room_url(@server, @room, :mobile => '1')
275
231
  url.gsub!(/http:\/\//i, "bigbluebutton://")
276
232
  has_element("a", { :href => url })
277
233
 
@@ -34,67 +34,51 @@ describe ActionController do
34
34
  {:delete => "/custom/servers/1"}.
35
35
  should route_to(:controller => "custom_servers", :action => "destroy", :id => "1")
36
36
  }
37
- it {
38
- {:get => "/custom/servers/1/activity"}.
39
- should route_to(:controller => "custom_servers", :action => "activity", :id => "1")
40
- }
41
37
 
42
38
  # custom controllers - rooms
43
39
  it {
44
- {:get => "/custom/rooms"}.
45
- should route_to(:controller => "custom_rooms", :action => "index")
46
- }
47
- it {
48
- {:get => "/custom/rooms/new"}.
49
- should route_to(:controller => "custom_rooms", :action => "new")
50
- }
51
- it {
52
- {:get => "/custom/rooms/1"}.
53
- should route_to(:controller => "custom_rooms", :action => "show", :id => "1")
54
- }
55
- it {
56
- {:get => "/custom/rooms/1/edit"}.
57
- should route_to(:controller => "custom_rooms", :action => "edit", :id => "1")
40
+ {:get => "/custom/servers/1/rooms"}.
41
+ should route_to(:controller => "custom_rooms", :action => "index", :server_id => "1")
58
42
  }
59
43
  it {
60
- {:put => "/custom/rooms/1"}.
61
- should route_to(:controller => "custom_rooms", :action => "update", :id => "1")
44
+ {:get => "/custom/servers/1/rooms/new"}.
45
+ should route_to(:controller => "custom_rooms", :action => "new", :server_id => "1")
62
46
  }
63
47
  it {
64
- {:delete => "/custom/rooms/1"}.
65
- should route_to(:controller => "custom_rooms", :action => "destroy", :id => "1")
48
+ {:get => "/custom/servers/1/rooms/1/edit"}.
49
+ should route_to(:controller => "custom_rooms", :action => "edit", :server_id => "1", :id => "1")
66
50
  }
67
51
  it {
68
- {:get => "/custom/rooms/external"}.
69
- should route_to(:controller => "custom_rooms", :action => "external")
52
+ {:get => "/custom/servers/1/rooms/1"}.
53
+ should route_to(:controller => "custom_rooms", :action => "show", :server_id => "1", :id => "1")
70
54
  }
71
55
  it {
72
- {:post => "/custom/rooms/external"}.
73
- should route_to(:controller => "custom_rooms", :action => "external_auth")
56
+ {:put => "/custom/servers/1/rooms/1"}.
57
+ should route_to(:controller => "custom_rooms", :action => "update", :server_id => "1", :id => "1")
74
58
  }
75
59
  it {
76
- {:get => "/custom/rooms/1/join"}.
77
- should route_to(:controller => "custom_rooms", :action => "join", :id => "1")
60
+ {:delete => "/custom/servers/1/rooms/1"}.
61
+ should route_to(:controller => "custom_rooms", :action => "destroy", :server_id => "1", :id => "1")
78
62
  }
79
63
  it {
80
- {:get => "/custom/rooms/1/join_mobile"}.
81
- should route_to(:controller => "custom_rooms", :action => "join_mobile" ,:id => "1")
64
+ {:get => "/custom/servers/1/rooms/1/join"}.
65
+ should route_to(:controller => "custom_rooms", :action => "join", :server_id => "1", :id => "1")
82
66
  }
83
67
  it {
84
- {:get => "/custom/rooms/1/running"}.
85
- should route_to(:controller => "custom_rooms", :action => "running", :id => "1")
68
+ {:get => "/custom/servers/1/rooms/1/running"}.
69
+ should route_to(:controller => "custom_rooms", :action => "running", :server_id => "1", :id => "1")
86
70
  }
87
71
  it {
88
- {:get => "/custom/rooms/1/end"}.
89
- should route_to(:controller => "custom_rooms", :action => "end", :id => "1")
72
+ {:get => "/custom/servers/1/rooms/1/end"}.
73
+ should route_to(:controller => "custom_rooms", :action => "end", :server_id => "1", :id => "1")
90
74
  }
91
75
  it {
92
- {:get => "/custom/rooms/1/invite"}.
93
- should route_to(:controller => "custom_rooms", :action => "invite", :id => "1")
76
+ {:get => "/custom/servers/1/rooms/1/invite"}.
77
+ should route_to(:controller => "custom_rooms", :action => "invite", :server_id => "1", :id => "1")
94
78
  }
95
79
  it {
96
- {:post => "/custom/rooms/1/join"}.
97
- should route_to(:controller => "custom_rooms", :action => "auth", :id => "1")
80
+ {:post => "/custom/servers/1/rooms/1/join"}.
81
+ should route_to(:controller => "custom_rooms", :action => "auth", :server_id => "1", :id => "1")
98
82
  }
99
83
 
100
84
  end