forked from External/greenlight
GRN2-180: First stages of refactoring code for v2.4 (#748)
* Email rescues and authenticator concern * Application controller and helper clean up * Moved controller code out of helpers * More helper and email clean up * Cleaned up remaining helpers and create omniauth_options * Controller code clean up * restructured views structure * Restructured role code * Restructured profile and code clean up * Master merge * Added bbb server concern to deal with bbb calls * Bug fixes and changes after changes * rspec * More rubocop fixes
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user