diff --git a/app/views/rooms/wait.html.erb b/app/views/rooms/wait.html.erb
index e93f153c..39171fbf 100644
--- a/app/views/rooms/wait.html.erb
+++ b/app/views/rooms/wait.html.erb
@@ -13,7 +13,7 @@
# with BigBlueButton; if not, see .
%>
-<%= render 'shared/room_event', render_recordings: true do %>
+<%= render 'rooms/components/room_event', render_recordings: true do %>
<%= t("room.wait.message") %>
diff --git a/app/views/shared/components/_resend_button.html.erb b/app/views/shared/components/_resend_button.html.erb
deleted file mode 100644
index 368b347f..00000000
--- a/app/views/shared/components/_resend_button.html.erb
+++ /dev/null
@@ -1,18 +0,0 @@
-<%
-# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
-# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
-# This program is free software; you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free Software
-# Foundation; either version 3.0 of the License, or (at your option) any later
-# version.
-#
-# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-# You should have received a copy of the GNU Lesser General Public License along
-# with BigBlueButton; if not, see .
-%>
-
-
diff --git a/app/views/shared/components/_terms_button.html.erb b/app/views/shared/components/_terms_button.html.erb
deleted file mode 100644
index de46d390..00000000
--- a/app/views/shared/components/_terms_button.html.erb
+++ /dev/null
@@ -1,18 +0,0 @@
-<%
-# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
-# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
-# This program is free software; you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free Software
-# Foundation; either version 3.0 of the License, or (at your option) any later
-# version.
-#
-# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-# You should have received a copy of the GNU Lesser General Public License along
-# with BigBlueButton; if not, see .
-%>
-
-
\ No newline at end of file
diff --git a/app/views/shared/modals/_delete_room_modal.html.erb b/app/views/shared/modals/_delete_room_modal.html.erb
index 3b7a1d8d..1bc42949 100644
--- a/app/views/shared/modals/_delete_room_modal.html.erb
+++ b/app/views/shared/modals/_delete_room_modal.html.erb
@@ -34,8 +34,8 @@
diff --git a/app/views/shared/components/_confirm_button.html.erb b/app/views/users/change_password.html.erb
similarity index 67%
rename from app/views/shared/components/_confirm_button.html.erb
rename to app/views/users/change_password.html.erb
index 8fdba35b..a06f02b7 100644
--- a/app/views/shared/components/_confirm_button.html.erb
+++ b/app/views/users/change_password.html.erb
@@ -12,7 +12,15 @@
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see .
%>
+
diff --git a/app/views/shared/settings/_account.html.erb b/app/views/users/components/_account.html.erb
similarity index 100%
rename from app/views/shared/settings/_account.html.erb
rename to app/views/users/components/_account.html.erb
diff --git a/app/views/shared/settings/_delete.html.erb b/app/views/users/components/_delete.html.erb
similarity index 100%
rename from app/views/shared/settings/_delete.html.erb
rename to app/views/users/components/_delete.html.erb
diff --git a/app/views/users/components/_menu_buttons.html.erb b/app/views/users/components/_menu_buttons.html.erb
new file mode 100644
index 00000000..860aa86d
--- /dev/null
+++ b/app/views/users/components/_menu_buttons.html.erb
@@ -0,0 +1,26 @@
+<%
+# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
+# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
+# This program is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free Software
+# Foundation; either version 3.0 of the License, or (at your option) any later
+# version.
+#
+# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+# You should have received a copy of the GNU Lesser General Public License along
+# with BigBlueButton; if not, see .
+%>
+
+
+ <%= link_to edit_user_path, class: "list-group-item list-group-item-action dropdown-item #{"active" if active_page == "edit"}" do %>
+ <%= t("settings.account.title") %>
+ <% end %>
+ <%= link_to change_password_path, class: "list-group-item list-group-item-action dropdown-item #{"active" if active_page == "change_password"}" do %>
+ <%= t("settings.password.title") %>
+ <% end %>
+ <%= link_to delete_account_path, class: "list-group-item list-group-item-action dropdown-item #{"active" if active_page == "delete_account"}" do %>
+ <%= t("settings.delete.title") %>
+ <% end %>
+
\ No newline at end of file
diff --git a/app/views/shared/settings/_password.html.erb b/app/views/users/components/_password.html.erb
similarity index 100%
rename from app/views/shared/settings/_password.html.erb
rename to app/views/users/components/_password.html.erb
diff --git a/app/views/shared/settings/_setting_view.html.erb b/app/views/users/components/_setting_view.html.erb
similarity index 92%
rename from app/views/shared/settings/_setting_view.html.erb
rename to app/views/users/components/_setting_view.html.erb
index 4c8b8bd2..915cdb06 100644
--- a/app/views/shared/settings/_setting_view.html.erb
+++ b/app/views/users/components/_setting_view.html.erb
@@ -17,10 +17,10 @@
<% end %>
diff --git a/app/views/shared/settings/_design.html.erb b/app/views/users/delete_account.html.erb
similarity index 70%
rename from app/views/shared/settings/_design.html.erb
rename to app/views/users/delete_account.html.erb
index e4f794c4..c05727cf 100644
--- a/app/views/shared/settings/_design.html.erb
+++ b/app/views/users/delete_account.html.erb
@@ -12,11 +12,15 @@
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see .
%>
+
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb
index 8ee6186d..0c7eefdb 100644
--- a/app/views/users/edit.html.erb
+++ b/app/views/users/edit.html.erb
@@ -12,48 +12,15 @@
# You should have received a copy of the GNU Lesser General Public License along
# with BigBlueButton; if not, see .
%>
-
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb
index d6f059f0..2f4b4f6b 100644
--- a/config/initializers/omniauth.rb
+++ b/config/initializers/omniauth.rb
@@ -1,6 +1,9 @@
# frozen_string_literal: true
require 'office365'
+require 'omniauth_options'
+
+include OmniauthOptions
# List of supported Omniauth providers.
Rails.application.config.providers = []
@@ -16,7 +19,7 @@ Rails.application.config.omniauth_office365 = ENV['OFFICE365_KEY'].present? &&
ENV['OFFICE365_SECRET'].present?
SETUP_PROC = lambda do |env|
- SessionsController.helpers.omniauth_options env
+ OmniauthOptions.omniauth_options env
end
OmniAuth.config.logger = Rails.logger
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 9966b463..0c5c68f2 100755
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -88,10 +88,9 @@ en:
roles:
can_create_rooms: Can create rooms
delete: Delete the role
- duplicate_name: The role name you provided was a duplicate. All role names must be unique
- empty_name: All roles must have a non empty name
- invalid_order: The user role must be the lowest priority role and the admin role must be the highest priority role
- invalid_update: You can't update a role with a higher priority than your own role
+ invalid_create: There was a problem creating a new role. Please check the role values and try again
+ invalid_order: There was a problem updating the priority of the role. Please check the values and try again
+ invalid_update: There was a problem updating the permissions of the role. Please check the values and try again
name: Role Name
new_role: Create a new role
role_has_users: This role is assigned to %{user_count} accounts. Please remove all accounts from this role before deleting it.
@@ -101,8 +100,7 @@ en:
edit_site_settings: Allow users with this role to edit site settings
edit_roles: Allow users with this role to edit other roles
manage_users: Allow users with this role to manage users
- invalid_assignment: You can't assign a role with a higher priority than your own to a user
- invalid_removal: You can't remove a role with a higher priority than your own
+ invalid_assignment: There was a problem assigning the roles to the user. Please check the values and try again
colour:
title: Role Colour
info: Set the colour that will be associated with the role
diff --git a/config/routes.rb b/config/routes.rb
index 49b80ce3..850c5266 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -37,25 +37,23 @@ Rails.application.routes.draw do
resources :admins, only: [:index]
scope '/admins' do
- get '/site_settings', to: 'admins#site_settings', as: :admin_site_settings
+ # Panel Tabs
get '/recordings', to: 'admins#server_recordings', as: :admin_recordings
- post '/branding', to: 'admins#branding', as: :admin_branding
- post '/coloring', to: 'admins#coloring', as: :admin_coloring
- post '/room_authentication', to: 'admins#room_authentication', as: :admin_room_authentication
- post '/coloring_lighten', to: 'admins#coloring_lighten', as: :admin_coloring_lighten
- post '/coloring_darken', to: 'admins#coloring_darken', as: :admin_coloring_darken
- post '/signup', to: 'admins#signup', as: :admin_signup
+ get '/site_settings', to: 'admins#site_settings', as: :admin_site_settings
+ get '/roles', to: 'admins#roles', as: :admin_roles
+ # Manage Users
get '/edit/:user_uid', to: 'admins#edit_user', as: :admin_edit_user
post '/ban/:user_uid', to: 'admins#ban_user', as: :admin_ban
post '/unban/:user_uid', to: 'admins#unban_user', as: :admin_unban
post '/invite', to: 'admins#invite', as: :invite_user
- post '/registration_method/:method', to: 'admins#registration_method', as: :admin_change_registration
post '/approve/:user_uid', to: 'admins#approve', as: :admin_approve
get '/reset', to: 'admins#reset', as: :admin_reset
- post '/room_limit', to: 'admins#room_limit', as: :admin_room_limit
- post '/default_recording_visibility', to: 'admins#default_recording_visibility', as: :admin_recording_visibility
+ # Site Settings
+ post '/update_settings', to: 'admins#update_settings', as: :admin_update_settings
+ post '/registration_method', to: 'admins#registration_method', as: :admin_change_registration
+ post '/coloring', to: 'admins#coloring', as: :admin_coloring
post '/clear_cache', to: 'admins#clear_cache', as: :admin_clear_cache
- get '/roles', to: 'admins#roles', as: :admin_roles
+ # Roles
post '/role', to: 'admins#new_role', as: :admin_new_role
patch 'roles/order', to: 'admins#change_role_order', as: :admin_roles_order
post '/role/:role_id', to: 'admins#update_role', as: :admin_update_role
@@ -86,6 +84,8 @@ Rails.application.routes.draw do
# Account management.
get '/:user_uid/edit', to: 'users#edit', as: :edit_user
+ get '/:user_uid/change_password', to: 'users#change_password', as: :change_password
+ get '/:user_uid/delete_account', to: 'users#delete_account', as: :delete_account
patch '/:user_uid/edit', to: 'users#update', as: :update_user
delete '/:user_uid', to: 'users#destroy', as: :delete_user
@@ -118,8 +118,8 @@ Rails.application.routes.draw do
scope '/:meetingID' do
# Manage recordings
scope '/:record_id' do
- post '/', to: 'recordings#update_recording', as: :update_recording
- delete '/', to: 'recordings#delete_recording', as: :delete_recording
+ post '/', to: 'recordings#update', as: :update_recording
+ delete '/', to: 'recordings#delete', as: :delete_recording
end
end
diff --git a/lib/omniauth_options.rb b/lib/omniauth_options.rb
new file mode 100644
index 00000000..0440f527
--- /dev/null
+++ b/lib/omniauth_options.rb
@@ -0,0 +1,71 @@
+# frozen_string_literal: true
+
+# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
+#
+# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
+#
+# This program is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free Software
+# Foundation; either version 3.0 of the License, or (at your option) any later
+# version.
+#
+# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License along
+# with BigBlueButton; if not, see .
+
+module OmniauthOptions
+ module_function
+
+ def omniauth_options(env)
+ if env['omniauth.strategy'].options[:name] == "bn_launcher"
+ protocol = Rails.env.production? ? "https" : env["rack.url_scheme"]
+
+ customer_redirect_url = protocol + "://" + env["SERVER_NAME"] + ":" +
+ env["SERVER_PORT"]
+ user_domain = parse_user_domain(env["SERVER_NAME"])
+ env['omniauth.strategy'].options[:customer] = user_domain
+ env['omniauth.strategy'].options[:customer_redirect_url] = customer_redirect_url
+ env['omniauth.strategy'].options[:default_callback_url] = Rails.configuration.gl_callback_url
+
+ # This is only used in the old launcher and should eventually be removed
+ env['omniauth.strategy'].options[:checksum] = generate_checksum(user_domain, customer_redirect_url,
+ Rails.configuration.launcher_secret)
+ elsif env['omniauth.strategy'].options[:name] == "google"
+ set_hd(env, ENV['GOOGLE_OAUTH2_HD'])
+ elsif env['omniauth.strategy'].options[:name] == "office365"
+ set_hd(env, ENV['OFFICE365_HD'])
+ end
+ end
+
+ # Limits the domain that can be used with the provider
+ def set_hd(env, hd)
+ if hd
+ hd_opts = hd.split(',')
+ env['omniauth.strategy'].options[:hd] = if hd_opts.empty?
+ nil
+ elsif hd_opts.length == 1
+ hd_opts[0]
+ else
+ hd_opts
+ end
+ end
+ end
+
+ # Parses the url for the user domain
+ def parse_user_domain(hostname)
+ return hostname.split('.').first if Rails.configuration.url_host.empty?
+ Rails.configuration.url_host.split(',').each do |url_host|
+ return hostname.chomp(url_host).chomp('.') if hostname.include?(url_host)
+ end
+ ''
+ end
+
+ # Generates a checksum to use alongside the omniauth request
+ def generate_checksum(user_domain, redirect_url, secret)
+ string = user_domain + redirect_url + secret
+ OpenSSL::Digest.digest('sha1', string).unpack1("H*")
+ end
+end
diff --git a/spec/concerns/bbb_server_spec.rb b/spec/concerns/bbb_server_spec.rb
new file mode 100644
index 00000000..350bcee0
--- /dev/null
+++ b/spec/concerns/bbb_server_spec.rb
@@ -0,0 +1,88 @@
+# frozen_string_literal: true
+
+# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
+#
+# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
+#
+# This program is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free Software
+# Foundation; either version 3.0 of the License, or (at your option) any later
+# version.
+#
+# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License along
+# with BigBlueButton; if not, see .
+
+require "rails_helper"
+require 'bigbluebutton_api'
+
+describe BbbServer do
+ include BbbServer
+
+ let(:bbb_server) { BigBlueButton::BigBlueButtonApi.new("http://bbb.example.com/bigbluebutton/api", "secret", "0.8") }
+
+ before do
+ @user = create(:user)
+ @room = @user.main_room
+ end
+
+ context "#running?" do
+ it "should return false when not running" do
+ expect(room_running?(@room.bbb_id)).to be false
+ end
+
+ it "should return true when running" do
+ allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:is_meeting_running?).and_return(true)
+ expect(room_running?(@room.bbb_id)).to be true
+ end
+ end
+
+ context "#start_session" do
+ it "should update latest session info" do
+ allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:create_meeting).and_return(
+ messageKey: ""
+ )
+
+ expect do
+ start_session(@room)
+ end.to change { @room.sessions }.by(1)
+
+ expect(@room.last_session).not_to be nil
+ end
+ end
+
+ context "#join_path" do
+ it "should return correct join URL for user" do
+ allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:get_meeting_info).and_return(
+ attendeePW: @room.attendee_pw
+ )
+
+ endpoint = Rails.configuration.bigbluebutton_endpoint
+ secret = Rails.configuration.bigbluebutton_secret
+ fullname = "fullName=Example"
+ join_via_html5 = "&join_via_html5=true"
+ meeting_id = "&meetingID=#{@room.bbb_id}"
+ password = "&password=#{@room.attendee_pw}"
+
+ query = fullname + join_via_html5 + meeting_id + password
+ checksum_string = "join#{query + secret}"
+
+ checksum = OpenSSL::Digest.digest('sha1', checksum_string).unpack1("H*")
+ expect(join_path(@room, "Example")).to eql("#{endpoint}join?#{query}&checksum=#{checksum}")
+ end
+ end
+
+ context "#recordings" do
+ it "deletes the recording" do
+ allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:delete_recordings).and_return(
+ returncode: true, deleted: true
+ )
+
+ expect(delete_recording(Faker::IDNumber.valid))
+ .to contain_exactly([:returncode, true], [:deleted, true])
+ end
+ end
+end
diff --git a/spec/concerns/recorder_spec.rb b/spec/concerns/recorder_spec.rb
index 7e082e1f..1a740a24 100644
--- a/spec/concerns/recorder_spec.rb
+++ b/spec/concerns/recorder_spec.rb
@@ -19,13 +19,15 @@
require "rails_helper"
require 'bigbluebutton_api'
-shared_examples_for "recorder" do
- let(:controller) { described_class } # the class that includes the concern
+describe Recorder do
+ include Recorder
+ include BbbServer
+
+ let(:bbb_server) { BigBlueButton::BigBlueButtonApi.new("http://bbb.example.com/bigbluebutton/api", "secret", "0.8") }
before do
@user = create(:user)
@room = @user.main_room
-
allow_any_instance_of(Room).to receive(:owner).and_return(@user)
end
@@ -44,7 +46,7 @@ shared_examples_for "recorder" do
]
)
- expect(recordings(@room.bbb_id, @room.owner.provider)).to contain_exactly(
+ expect(recordings(@room.bbb_id)).to contain_exactly(
name: "Example",
playbacks:
[
@@ -118,7 +120,7 @@ shared_examples_for "recorder" do
]
)
- expect(all_recordings(@user.rooms.pluck(:bbb_id), @user.provider, search: "Exam", column: "name",
+ expect(all_recordings(@user.rooms.pluck(:bbb_id), search: "Exam", column: "name",
direction: "desc")).to eq(
[
{
@@ -219,7 +221,7 @@ shared_examples_for "recorder" do
end
it "should filter recordings on name" do
- expect(recordings(@room.bbb_id, @room.owner.provider, search: "Exam")).to contain_exactly(
+ expect(recordings(@room.bbb_id, search: "Exam")).to contain_exactly(
{
meetingID: @room.bbb_id,
name: "aExamaaa",
@@ -250,7 +252,7 @@ shared_examples_for "recorder" do
end
it "should filter recordings on participants" do
- expect(recordings(@room.bbb_id, @room.owner.provider, search: "5")).to contain_exactly(
+ expect(recordings(@room.bbb_id, search: "5")).to contain_exactly(
meetingID: @room.bbb_id,
name: "aExamaaa",
participants: "5",
@@ -267,7 +269,7 @@ shared_examples_for "recorder" do
end
it "should filter recordings on format" do
- expect(recordings(@room.bbb_id, @room.owner.provider, search: "presentation")).to contain_exactly(
+ expect(recordings(@room.bbb_id, search: "presentation")).to contain_exactly(
{
meetingID: @room.bbb_id,
name: "test",
@@ -298,7 +300,7 @@ shared_examples_for "recorder" do
end
it "should filter recordings on visibility" do
- expect(recordings(@room.bbb_id, @room.owner.provider, search: "public")).to contain_exactly(
+ expect(recordings(@room.bbb_id, search: "public")).to contain_exactly(
{
meetingID: @room.bbb_id,
name: "test",
@@ -329,7 +331,7 @@ shared_examples_for "recorder" do
end
it "should filter recordings on metadata name by default" do
- expect(recordings(@room.bbb_id, @room.owner.provider, search: "metadata")).to contain_exactly(
+ expect(recordings(@room.bbb_id, search: "metadata")).to contain_exactly(
meetingID: @room.bbb_id,
name: "Exam",
participants: "1",
@@ -385,7 +387,7 @@ shared_examples_for "recorder" do
end
it "should sort recordings on name" do
- expect(recordings(@room.bbb_id, @room.owner.provider, column: "name", direction: "asc")).to eq(
+ expect(recordings(@room.bbb_id, column: "name", direction: "asc")).to eq(
[
{
meetingID: @room.bbb_id,
@@ -421,7 +423,7 @@ shared_examples_for "recorder" do
end
it "should sort recordings on participants" do
- expect(recordings(@room.bbb_id, @room.owner.provider, column: "users", direction: "desc")).to eq(
+ expect(recordings(@room.bbb_id, column: "users", direction: "desc")).to eq(
[
{
meetingID: @room.bbb_id,
@@ -457,7 +459,7 @@ shared_examples_for "recorder" do
end
it "should sort recordings on visibility" do
- expect(recordings(@room.bbb_id, @room.owner.provider, column: "visibility", direction: "desc")).to eq(
+ expect(recordings(@room.bbb_id, column: "visibility", direction: "desc")).to eq(
[
{
meetingID: @room.bbb_id,
@@ -493,7 +495,7 @@ shared_examples_for "recorder" do
end
it "should sort recordings on length" do
- expect(recordings(@room.bbb_id, @room.owner.provider, column: "length", direction: "asc")).to eq(
+ expect(recordings(@room.bbb_id, column: "length", direction: "asc")).to eq(
[
{
meetingID: @room.bbb_id,
@@ -529,7 +531,7 @@ shared_examples_for "recorder" do
end
it "should sort recordings on format" do
- expect(recordings(@room.bbb_id, @room.owner.provider, column: "formats", direction: "desc")).to eq(
+ expect(recordings(@room.bbb_id, column: "formats", direction: "desc")).to eq(
[
{
meetingID: @room.bbb_id,
diff --git a/spec/controllers/account_activations_controller_spec.rb b/spec/controllers/account_activations_controller_spec.rb
index 9c5c5632..7fb4fcbd 100644
--- a/spec/controllers/account_activations_controller_spec.rb
+++ b/spec/controllers/account_activations_controller_spec.rb
@@ -37,7 +37,7 @@ describe AccountActivationsController, type: :controller do
get :show, params: { email: user.email }
- expect(response).to render_template(:verify)
+ expect(response).to render_template(:show)
end
end
diff --git a/spec/controllers/admins_controller_spec.rb b/spec/controllers/admins_controller_spec.rb
index 8a9d73f9..8f440df0 100644
--- a/spec/controllers/admins_controller_spec.rb
+++ b/spec/controllers/admins_controller_spec.rb
@@ -91,7 +91,7 @@ describe AdminsController, type: :controller do
context "POST #invite" do
before do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
- allow_any_instance_of(ApplicationController).to receive(:allow_greenlight_users?).and_return(true)
+ allow_any_instance_of(ApplicationController).to receive(:allow_greenlight_accounts?).and_return(true)
allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
end
@@ -177,7 +177,7 @@ describe AdminsController, type: :controller do
@request.session[:user_id] = @admin.id
fake_image_url = "example.com"
- post :branding, params: { url: fake_image_url }
+ post :update_settings, params: { setting: "Branding Image", value: fake_image_url }
feature = Setting.find_by(provider: "provider1").features.find_by(name: "Branding Image")
@@ -194,7 +194,7 @@ describe AdminsController, type: :controller do
@request.session[:user_id] = @admin.id
primary_color = Faker::Color.hex_color
- post :coloring, params: { color: primary_color }
+ post :coloring, params: { value: primary_color }
feature = Setting.find_by(provider: "provider1").features.find_by(name: "Primary Color")
@@ -209,7 +209,7 @@ describe AdminsController, type: :controller do
@request.session[:user_id] = @admin.id
primary_color = Faker::Color.hex_color
- post :coloring_lighten, params: { color: primary_color }
+ post :update_settings, params: { setting: "Primary Color Lighten", value: primary_color }
feature = Setting.find_by(provider: "provider1").features.find_by(name: "Primary Color Lighten")
@@ -224,7 +224,7 @@ describe AdminsController, type: :controller do
@request.session[:user_id] = @admin.id
primary_color = Faker::Color.hex_color
- post :coloring_darken, params: { color: primary_color }
+ post :update_settings, params: { setting: "Primary Color Darken", value: primary_color }
feature = Setting.find_by(provider: "provider1").features.find_by(name: "Primary Color Darken")
@@ -243,7 +243,7 @@ describe AdminsController, type: :controller do
@request.session[:user_id] = @admin.id
- post :registration_method, params: { method: "invite" }
+ post :registration_method, params: { value: "invite" }
feature = Setting.find_by(provider: "provider1").features.find_by(name: "Registration Method")
@@ -259,7 +259,7 @@ describe AdminsController, type: :controller do
@request.session[:user_id] = @admin.id
- post :registration_method, params: { method: "invite" }
+ post :registration_method, params: { value: "invite" }
expect(flash[:alert]).to be_present
expect(response).to redirect_to(admin_site_settings_path)
@@ -273,7 +273,7 @@ describe AdminsController, type: :controller do
@request.session[:user_id] = @admin.id
- post :room_authentication, params: { value: "true" }
+ post :update_settings, params: { setting: "Room Authentication", value: "true" }
feature = Setting.find_by(provider: "provider1").features.find_by(name: "Room Authentication")
@@ -289,7 +289,7 @@ describe AdminsController, type: :controller do
@request.session[:user_id] = @admin.id
- post :room_limit, params: { limit: 5 }
+ post :update_settings, params: { setting: "Room Limit", value: 5 }
feature = Setting.find_by(provider: "provider1").features.find_by(name: "Room Limit")
@@ -305,7 +305,7 @@ describe AdminsController, type: :controller do
@request.session[:user_id] = @admin.id
- post :default_recording_visibility, params: { visibility: "public" }
+ post :update_settings, params: { setting: "Default Recording Visibility", value: "public" }
feature = Setting.find_by(provider: "provider1").features.find_by(name: "Default Recording Visibility")
@@ -353,7 +353,7 @@ describe AdminsController, type: :controller do
post :new_role, params: { role: { name: "admin" } }
expect(response).to redirect_to admin_roles_path
- expect(flash[:alert]).to eq(I18n.t("administrator.roles.duplicate_name"))
+ expect(flash[:alert]).to eq(I18n.t("administrator.roles.invalid_create"))
end
it "should fail with empty role name" do
@@ -362,7 +362,7 @@ describe AdminsController, type: :controller do
post :new_role, params: { role: { name: " " } }
expect(response).to redirect_to admin_roles_path
- expect(flash[:alert]).to eq(I18n.t("administrator.roles.empty_name"))
+ expect(flash[:alert]).to eq(I18n.t("administrator.roles.invalid_create"))
end
it "should create new role and increase user role priority" do
@@ -412,7 +412,7 @@ describe AdminsController, type: :controller do
patch :change_role_order, params: { role: [new_role3.id, new_role2.id] }
- expect(flash[:alert]).to eq(I18n.t("administrator.roles.invalid_update"))
+ expect(flash[:alert]).to eq(I18n.t("administrator.roles.invalid_order"))
expect(response).to redirect_to admin_roles_path
end
@@ -432,7 +432,7 @@ describe AdminsController, type: :controller do
patch :change_role_order, params: { role: [new_role3.id, new_role2.id] }
- expect(flash[:alert]).to eq(I18n.t("administrator.roles.invalid_update"))
+ expect(flash[:alert]).to eq(I18n.t("administrator.roles.invalid_order"))
expect(response).to redirect_to admin_roles_path
end
@@ -489,7 +489,7 @@ describe AdminsController, type: :controller do
patch :update_role, params: { role_id: new_role.id, role: { name: "admin" } }
- expect(flash[:alert]).to eq(I18n.t("administrator.roles.duplicate_name"))
+ expect(flash[:alert]).to eq(I18n.t("administrator.roles.invalid_update"))
expect(response).to redirect_to admin_roles_path(selected_role: new_role.id)
end
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index 0085a6e7..ff05ea6d 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -63,6 +63,64 @@ describe ApplicationController do
end
end
+ context "getters" do
+ it "returns whether user signup is allowed" do
+ allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
+
+ expect(controller.allow_user_signup?).to eql(true)
+ end
+
+ it "returns whether the default bbb endpoint is being used" do
+ allow(Rails.configuration).to receive(:bigbluebutton_endpoint)
+ .and_return("http://test-install.blindsidenetworks.com/bigbluebutton/api/")
+ allow(Rails.configuration).to receive(:bigbluebutton_endpoint_default)
+ .and_return("http://test-install.blindsidenetworks.com/bigbluebutton/api/")
+
+ expect(controller.bigbluebutton_endpoint_default?).to eql(true)
+ end
+ end
+
+ context "allow_greenlight_accounts" do
+ it "allows if user sign up is turned on" do
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(false)
+ allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
+
+ expect(controller.allow_greenlight_accounts?).to eql(true)
+ end
+
+ it "doesn't allow if user sign up is turned off" do
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(false)
+ allow(Rails.configuration).to receive(:allow_user_signup).and_return(false)
+
+ expect(controller.allow_greenlight_accounts?).to eql(false)
+ end
+
+ it "doesn't allow if user_domain is blank" do
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
+ allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
+
+ expect(controller.allow_greenlight_accounts?).to eql(false)
+ end
+
+ it "allows if user provider is set to greenlight" do
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
+ allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
+ allow(controller).to receive(:retrieve_provider_info).and_return("provider" => "greenlight")
+ controller.instance_variable_set(:@user_domain, "provider1")
+
+ expect(controller.allow_greenlight_accounts?).to eql(true)
+ end
+
+ it "doesnt allow if user provider is not set to greenlight" do
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
+ allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
+ allow(controller).to receive(:retrieve_provider_info).and_return("provider" => "google")
+ controller.instance_variable_set(:@user_domain, "provider1")
+
+ expect(controller.allow_greenlight_accounts?).to eql(false)
+ end
+ end
+
context "errors" do
it "renders a BigBlueButton error if a BigBlueButtonException occurrs" do
routes.draw { get "error" => "anonymous#error" }
@@ -74,7 +132,7 @@ describe ApplicationController do
it "renders a 404 error if user is not found" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
allow(Rails.env).to receive(:test?).and_return(false)
- allow_any_instance_of(SessionsHelper).to receive(:parse_user_domain).and_return("fake_provider")
+ allow_any_instance_of(ApplicationController).to receive(:parse_user_domain).and_return("fake_provider")
allow_any_instance_of(BbbApi).to receive(:retrieve_provider_info).and_raise("No user with that id exists")
routes.draw { get "user_not_found" => "anonymous#user_not_found" }
@@ -86,7 +144,7 @@ describe ApplicationController do
it "renders a 404 error if user is not given" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
allow(Rails.env).to receive(:test?).and_return(false)
- allow_any_instance_of(SessionsHelper).to receive(:parse_user_domain).and_return("")
+ allow_any_instance_of(ApplicationController).to receive(:parse_user_domain).and_return("")
allow_any_instance_of(BbbApi).to receive(:retrieve_provider_info).and_raise("Provider not included.")
routes.draw { get "user_not_found" => "anonymous#user_not_found" }
@@ -98,7 +156,7 @@ describe ApplicationController do
it "renders a 500 error if any other error related to bbb api" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
allow(Rails.env).to receive(:test?).and_return(false)
- allow_any_instance_of(SessionsHelper).to receive(:parse_user_domain).and_return("")
+ allow_any_instance_of(ApplicationController).to receive(:parse_user_domain).and_return("")
allow_any_instance_of(BbbApi).to receive(:retrieve_provider_info).and_raise("Other error")
routes.draw { get "user_not_found" => "anonymous#user_not_found" }
diff --git a/spec/controllers/password_resets_controller_spec.rb b/spec/controllers/password_resets_controller_spec.rb
index 5fedb819..82ae4475 100644
--- a/spec/controllers/password_resets_controller_spec.rb
+++ b/spec/controllers/password_resets_controller_spec.rb
@@ -73,7 +73,9 @@ describe PasswordResetsController, type: :controller do
end
describe "PATCH #update" do
- before { allow(Rails.configuration).to receive(:enable_email_verification).and_return(true) }
+ before do
+ allow(Rails.configuration).to receive(:enable_email_verification).and_return(true)
+ end
context "valid user" do
it "reloads page with notice if password is empty" do
@@ -120,7 +122,7 @@ describe PasswordResetsController, type: :controller do
allow(controller).to receive(:valid_user).and_return(nil)
allow(controller).to receive(:check_expiration).and_return(nil)
- allow(controller).to receive(:current_user).and_return(user)
+ controller.instance_variable_set(:@user, user)
params = {
id: token,
diff --git a/spec/controllers/recordings_controller_spec.rb b/spec/controllers/recordings_controller_spec.rb
index c66764e6..f7f23b14 100644
--- a/spec/controllers/recordings_controller_spec.rb
+++ b/spec/controllers/recordings_controller_spec.rb
@@ -27,10 +27,10 @@ describe RecordingsController, type: :controller do
context "POST #update_recording" do
it "updates the recordings details" do
- allow_any_instance_of(Room).to receive(:update_recording).and_return(updated: true)
+ allow_any_instance_of(BbbServer).to receive(:update_recording).and_return(updated: true)
@request.session[:user_id] = @user.uid
- post :update_recording, params: { meetingID: @room.bbb_id, record_id: Faker::IDNumber.valid, state: "public" }
+ post :update, params: { meetingID: @room.bbb_id, record_id: Faker::IDNumber.valid, state: "public" }
expect(response).to have_http_status(302)
end
@@ -38,7 +38,7 @@ describe RecordingsController, type: :controller do
it "redirects to root if not the room owner" do
@request.session[:user_id] = @secondary_user.uid
- post :update_recording, params: { meetingID: @room.bbb_id, record_id: Faker::IDNumber.valid, state: "public" }
+ post :update, params: { meetingID: @room.bbb_id, record_id: Faker::IDNumber.valid, state: "public" }
expect(response).to redirect_to(root_path)
end
@@ -46,10 +46,10 @@ describe RecordingsController, type: :controller do
context "DELETE #delete_recording" do
it "deletes the recording" do
- allow_any_instance_of(Room).to receive(:delete_recording).and_return(true)
+ allow_any_instance_of(BbbServer).to receive(:delete_recording).and_return(true)
@request.session[:user_id] = @user.uid
- post :delete_recording, params: { meetingID: @room.bbb_id, record_id: Faker::IDNumber.valid, state: "public" }
+ post :delete, params: { meetingID: @room.bbb_id, record_id: Faker::IDNumber.valid, state: "public" }
expect(response).to have_http_status(302)
end
@@ -57,7 +57,7 @@ describe RecordingsController, type: :controller do
it "redirects to root if not the room owner" do
@request.session[:user_id] = @secondary_user.uid
- post :delete_recording, params: { meetingID: @room.bbb_id, record_id: Faker::IDNumber.valid, state: "public" }
+ post :delete, params: { meetingID: @room.bbb_id, record_id: Faker::IDNumber.valid, state: "public" }
expect(response).to redirect_to(root_path)
end
diff --git a/spec/controllers/rooms_controller_spec.rb b/spec/controllers/rooms_controller_spec.rb
index 1424ab66..e3062ed9 100644
--- a/spec/controllers/rooms_controller_spec.rb
+++ b/spec/controllers/rooms_controller_spec.rb
@@ -28,8 +28,11 @@ def random_valid_room_params
end
describe RoomsController, type: :controller do
- it_behaves_like "recorder"
include Recorder
+ include BbbServer
+
+ let(:bbb_server) { BigBlueButton::BigBlueButtonApi.new("http://bbb.example.com/bigbluebutton/api", "secret", "0.8") }
+
describe "GET #show" do
before do
@user = create(:user)
@@ -41,8 +44,7 @@ describe RoomsController, type: :controller do
get :show, params: { room_uid: @owner.main_room }
- expect(assigns(:recordings)).to eql(recordings(@owner.main_room.bbb_id, @owner.provider))
- expect(assigns(:is_running)).to eql(@owner.main_room.running?)
+ expect(assigns(:recordings)).to eql(recordings(@owner.main_room.bbb_id))
end
it "should be able to search recordings if user is owner" do
@@ -199,11 +201,6 @@ describe RoomsController, type: :controller do
@user = create(:user)
@owner = create(:user)
@room = @owner.main_room
-
- allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:get_meeting_info).and_return(
- moderatorPW: "modpass",
- attendeePW: "attpass",
- )
end
it "should use account name if user is logged in and meeting running" do
@@ -212,7 +209,7 @@ describe RoomsController, type: :controller do
@request.session[:user_id] = @user.id
post :join, params: { room_uid: @room, join_name: @user.name }
- expect(response).to redirect_to(@owner.main_room.join_path(@user.name, {}, @user.uid))
+ expect(response).to redirect_to(join_path(@owner.main_room, @user.name, {}, @user.uid))
end
it "should use join name if user is not logged in and meeting running" do
@@ -220,7 +217,7 @@ describe RoomsController, type: :controller do
post :join, params: { room_uid: @room, join_name: "Join Name" }
- expect(response).to redirect_to(@owner.main_room.join_path("Join Name", {}))
+ expect(response).to redirect_to(join_path(@owner.main_room, "Join Name", {}))
end
it "should render wait if meeting isn't running" do
@@ -243,7 +240,7 @@ describe RoomsController, type: :controller do
@request.session[:user_id] = @user.id
post :join, params: { room_uid: room, join_name: @user.name }
- expect(response).to redirect_to(room.join_path(@user.name, { user_is_moderator: false }, @user.uid))
+ expect(response).to redirect_to(join_path(room, @user.name, { user_is_moderator: false }, @user.uid))
end
it "should join the room as moderator if room has the all_join_moderator setting" do
@@ -257,7 +254,7 @@ describe RoomsController, type: :controller do
@request.session[:user_id] = @user.id
post :join, params: { room_uid: room, join_name: @user.name }
- expect(response).to redirect_to(room.join_path(@user.name, { user_is_moderator: true }, @user.uid))
+ expect(response).to redirect_to(join_path(room, @user.name, { user_is_moderator: true }, @user.uid))
end
it "should render wait if the correct access code is supplied" do
@@ -292,7 +289,7 @@ describe RoomsController, type: :controller do
@request.session[:user_id] = @owner.id
post :join, params: { room_uid: @room, join_name: @owner.name }
- expect(response).to redirect_to(@owner.main_room.join_path(@owner.name, { user_is_moderator: true }, @owner.uid))
+ expect(response).to redirect_to(join_path(@owner.main_room, @owner.name, { user_is_moderator: true }, @owner.uid))
end
it "redirects to root if owner of room is not verified" do
@@ -362,7 +359,7 @@ describe RoomsController, type: :controller do
@request.session[:user_id] = @user.id
post :start, params: { room_uid: @user.main_room }
- expect(response).to redirect_to(@user.main_room.join_path(@user.name, { user_is_moderator: true }, @user.uid))
+ expect(response).to redirect_to(join_path(@user.main_room, @user.name, { user_is_moderator: true }, @user.uid))
end
it "should bring to room if not owner" do
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 97c71ce5..1a603aac 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -373,7 +373,7 @@ describe UsersController, type: :controller do
user.reload
- expect(flash[:alert]).to eq(I18n.t("administrator.roles.invalid_removal"))
+ expect(flash[:alert]).to eq(I18n.t("administrator.roles.invalid_assignment"))
expect(response).to render_template(:edit)
end
@@ -439,7 +439,6 @@ describe UsersController, type: :controller do
it "allows admins to delete users" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
- allow_any_instance_of(Room).to receive(:delete_all_recordings).and_return('')
allow_any_instance_of(ApplicationController).to receive(:set_user_domain).and_return("provider1")
controller.instance_variable_set(:@user_domain, "provider1")
diff --git a/spec/helpers/admins_helper_spec.rb b/spec/helpers/admins_helper_spec.rb
deleted file mode 100644
index e690bd35..00000000
--- a/spec/helpers/admins_helper_spec.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# frozen_string_literal: true
-
-# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
-#
-# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
-#
-# This program is free software; you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free Software
-# Foundation; either version 3.0 of the License, or (at your option) any later
-# version.
-#
-# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with BigBlueButton; if not, see .
-
-require "rails_helper"
-
-describe AdminsHelper do
- describe "edit_disabled" do
- it "should disable inputs for roles with a higher priority" do
- user = create(:user)
- admin_role = Role.find_by(name: "admin", provider: "greenlight")
- helper.instance_variable_set(:@selected_role, admin_role)
-
- allow_any_instance_of(SessionsHelper).to receive(:current_user).and_return(user)
-
- expect(helper.edit_disabled).to eq(true)
- end
-
- it "should enable inputs for roles with a lower priority" do
- user = create(:user)
- user.roles << Role.find_by(name: "admin", provider: "greenlight")
- user_role = Role.find_by(name: "user", provider: "greenlight")
- helper.instance_variable_set(:@selected_role, user_role)
-
- allow_any_instance_of(SessionsHelper).to receive(:current_user).and_return(user)
-
- expect(helper.edit_disabled).to eq(false)
- end
- end
-end
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index d3514529..fe473c6d 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -20,21 +20,6 @@ require "rails_helper"
describe ApplicationHelper do
describe "#getter functions" do
- it "returns whether user signup is allowed" do
- allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
-
- expect(helper.allow_user_signup?).to eql(true)
- end
-
- it "returns whether the default bbb endpoint is being used" do
- allow(Rails.configuration).to receive(:bigbluebutton_endpoint)
- .and_return("http://test-install.blindsidenetworks.com/bigbluebutton/api/")
- allow(Rails.configuration).to receive(:bigbluebutton_endpoint_default)
- .and_return("http://test-install.blindsidenetworks.com/bigbluebutton/api/")
-
- expect(helper.bigbluebutton_endpoint_default?).to eql(true)
- end
-
it "returns the correct omniauth login url" do
allow(Rails.configuration).to receive(:relative_url_root).and_return("/b")
provider = Faker::Company.name
@@ -43,51 +28,8 @@ describe ApplicationHelper do
end
end
- describe "#allow_greenlight_accounts" do
- it "allows if user sign up is turned on" do
- allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(false)
- allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
-
- expect(helper.allow_greenlight_accounts?).to eql(true)
- end
-
- it "doesn't allow if user sign up is turned off" do
- allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(false)
- allow(Rails.configuration).to receive(:allow_user_signup).and_return(false)
-
- expect(helper.allow_greenlight_accounts?).to eql(false)
- end
-
- it "doesn't allow if user_domain is blank" do
- allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
- allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
-
- expect(helper.allow_greenlight_accounts?).to eql(false)
- end
-
- it "allows if user provider is set to greenlight" do
- allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
- allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
- allow(helper).to receive(:retrieve_provider_info).and_return("provider" => "greenlight")
-
- @user_domain = "provider1"
-
- expect(helper.allow_greenlight_accounts?).to eql(true)
- end
-
- it "doesnt allow if user provider is not set to greenlight" do
- allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
- allow(Rails.configuration).to receive(:allow_user_signup).and_return(true)
- allow(helper).to receive(:retrieve_provider_info).and_return("provider" => "google")
-
- @user_domain = "provider1"
-
- expect(helper.allow_greenlight_accounts?).to eql(false)
- end
- end
-
- describe "role_clour" do
- it "should use default if the user doens't have a role" do
+ describe "role_colur" do
+ it "should use default if the user doesn't have a role" do
expect(helper.role_colour(Role.create(name: "test"))).to eq(Rails.configuration.primary_color_default)
end
diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb
deleted file mode 100644
index eabe2661..00000000
--- a/spec/helpers/users_helper_spec.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# frozen_string_literal: true
-
-# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
-#
-# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
-#
-# This program is free software; you can redistribute it and/or modify it under the
-# terms of the GNU Lesser General Public License as published by the Free Software
-# Foundation; either version 3.0 of the License, or (at your option) any later
-# version.
-#
-# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License along
-# with BigBlueButton; if not, see .
-
-require "rails_helper"
-
-describe UsersHelper do
- describe "disabled roles" do
- it "should return roles with a less than or equal to priority for non admins" do
- user = create(:user)
- allow_any_instance_of(SessionsHelper).to receive(:current_user).and_return(user)
-
- disabled_roles = helper.disabled_roles(user)
-
- expect(disabled_roles.count).to eq(1)
- end
-
- it "should return roles with a lesser priority for admins" do
- admin = create(:user)
- admin.add_role :admin
- user = create(:user)
-
- allow_any_instance_of(SessionsHelper).to receive(:current_user).and_return(admin)
-
- disabled_roles = helper.disabled_roles(user)
-
- expect(disabled_roles.count).to eq(1)
- end
- end
-end
diff --git a/spec/models/room_spec.rb b/spec/models/room_spec.rb
index ab02bb5e..af49df8e 100644
--- a/spec/models/room_spec.rb
+++ b/spec/models/room_spec.rb
@@ -62,52 +62,6 @@ describe Room, type: :model do
end
end
- context "#running?" do
- it "should return false when not running" do
- expect(@room.running?).to be false
- end
-
- it "should return true when running" do
- allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:is_meeting_running?).and_return(true)
- expect(@room.running?).to be true
- end
- end
-
- context "#start_session" do
- it "should update latest session info" do
- allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:create_meeting).and_return(
- messageKey: ""
- )
-
- expect do
- @room.start_session
- end.to change { @room.sessions }.by(1)
-
- expect(@room.last_session).not_to be nil
- end
- end
-
- context "#join_path" do
- it "should return correct join URL for user" do
- allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:get_meeting_info).and_return(
- attendeePW: "testpass"
- )
-
- endpoint = Rails.configuration.bigbluebutton_endpoint
- secret = Rails.configuration.bigbluebutton_secret
- fullname = "fullName=Example"
- join_via_html5 = "&join_via_html5=true"
- meeting_id = "&meetingID=#{@room.bbb_id}"
- password = "&password=testpass"
-
- query = fullname + join_via_html5 + meeting_id + password
- checksum_string = "join#{query + secret}"
-
- checksum = OpenSSL::Digest.digest('sha1', checksum_string).unpack1("H*")
- expect(@room.join_path("Example")).to eql("#{endpoint}join?#{query}&checksum=#{checksum}")
- end
- end
-
context "#notify_waiting" do
it "should broadcast to waiting channel with started action" do
expect do
@@ -115,32 +69,4 @@ describe Room, type: :model do
end.to have_broadcasted_to("#{@room.uid}_waiting_channel").with(a_hash_including(action: "started"))
end
end
-
- context "#participants" do
- it "should link participants to accounts" do
- user1 = create(:user)
- user2 = create(:user)
-
- allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:get_meeting_info).and_return(
- attendees: [
- { userID: user1.uid, fullName: user1.name },
- { userID: "non-matching-uid", fullName: "Guest User" },
- { userID: user2.uid, fullName: user2.name },
- ],
- )
-
- expect(@room.participants).to contain_exactly(user1, nil, user2)
- end
- end
-
- context "#recordings" do
- it "deletes the recording" do
- allow_any_instance_of(BigBlueButton::BigBlueButtonApi).to receive(:delete_recordings).and_return(
- returncode: true, deleted: true
- )
-
- expect(@room.delete_recording(Faker::IDNumber.valid))
- .to contain_exactly([:returncode, true], [:deleted, true])
- end
- end
end