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:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user