GRN2-118: Create a setting to require authentication to join a room (#541)

* Create a setting to require authentication to join a room

* Apply comments
This commit is contained in:
shawn-higgins1
2019-05-22 13:44:40 -04:00
committed by Jesus Federico
parent 996518eea7
commit 70acb9a7e1
11 changed files with 89 additions and 14 deletions

View File

@ -278,5 +278,22 @@ describe AdminsController, type: :controller do
expect(response).to redirect_to(admins_path)
end
end
context "POST #room_authentication" do
it "changes the room authentication required setting" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
@request.session[:user_id] = @admin.id
checked = true
post :room_authentication, params: { authenticationRequired: checked }
feature = Setting.find_by(provider: "provider1").features.find_by(name: "Room Authentication")
expect(feature[:value]).to eq(checked.to_s)
expect(response).to redirect_to(admins_path)
end
end
end
end

View File

@ -206,6 +206,14 @@ describe RoomsController, type: :controller do
expect(flash[:alert]).to be_present
expect(response).to redirect_to(root_path)
end
it "should not allow the user to join if the user isn't signed in and room authentication is required" do
allow_any_instance_of(Setting).to receive(:get_value).and_return("true")
post :join, params: { room_uid: @room }
expect(response).to redirect_to(signin_path)
end
end
describe "DELETE #destroy" do