* Removes FeatureFlag.enabled?(:creator_onboarding) from codebase * Removes FeatureFlag.enabled?(:creator_onboarding) from specs * Further cleanup, removal, and spec fixes * Fixes the user_request_confirmation_spec.rb * Reverts change to confirmation email button * Revert revert after looking at designs again :( * Removes redundant logo_png field from config + fixes test * Rewords an expectation in user_uses_the_editor_spec.rb * Revert removal of logo_png from Config images * Removes CSS class from user_uses_the_editor_spec.rb * Removes test from user_uses_the_editor_sepc.rb * Removes unnecessary else from _logo.html.erb * Adds back removed system spec * Removes SVG-related code from _logo.html.erb * Removes AsyncInfoController#use_creator_onboarding * Fixes spec failues due to removed code * Removes svg-related code (that I thought I removed already :/ ) * Re-removes FeatureFlag and logo_svg from _images.html.erb * Remove newest instances of FeatureFlag(:creator_onboarding) * remove instances where we use the creator_onboarding field from the base_data * fix: redirect to the correct path in the reguistrations controller based on whether the user is a creator or not Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
72 lines
2 KiB
Ruby
72 lines
2 KiB
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "/creator_settings/new", type: :request do
|
|
let!(:current_user) { create(:user, :creator) }
|
|
let!(:non_admin_user) { create(:user) }
|
|
let(:params) do
|
|
{ creator_settings_form:
|
|
{
|
|
checked_code_of_conduct: true,
|
|
checked_terms_and_conditions: true,
|
|
community_name: "Climbing Life",
|
|
invite_only_mode: false,
|
|
primary_brand_color_hex: "#000000",
|
|
public: true
|
|
} }
|
|
end
|
|
|
|
before do
|
|
allow(Settings::General).to receive(:waiting_on_first_user).and_return(false)
|
|
end
|
|
|
|
describe "GET /admin/creator_settings/new" do
|
|
before do
|
|
sign_in current_user
|
|
get new_admin_creator_setting_path
|
|
end
|
|
|
|
context "when the user is a creator" do
|
|
it "allows the request" do
|
|
expect(response).to have_http_status(:ok)
|
|
end
|
|
|
|
it "renders the correct page" do
|
|
expect(response.body).to include("Lovely! Let's set up your Forem.")
|
|
end
|
|
end
|
|
|
|
context "when the user is a not a creator" do
|
|
before do
|
|
sign_in non_admin_user
|
|
end
|
|
|
|
it "blocks the request" do
|
|
expect do
|
|
get new_admin_creator_setting_path
|
|
end.to raise_error(Pundit::NotAuthorizedError)
|
|
end
|
|
end
|
|
|
|
describe "POST /admin/creator_settings/new" do
|
|
before do
|
|
sign_in current_user
|
|
get new_admin_creator_setting_path
|
|
end
|
|
|
|
it "allows a creator to successfully fill out the creator setup form", :aggregate_failures do
|
|
post admin_creator_settings_path, params: params
|
|
|
|
expect(current_user.saw_onboarding).to eq(true)
|
|
expect(current_user.checked_code_of_conduct).to eq(true)
|
|
expect(current_user.checked_terms_and_conditions).to eq(true)
|
|
expect(response).to redirect_to(:root).and have_http_status(:found)
|
|
end
|
|
|
|
it "updates settings admin action taken" do
|
|
expect do
|
|
post admin_creator_settings_path, params: params
|
|
end.to change(Settings::General, :admin_action_taken_at)
|
|
end
|
|
end
|
|
end
|
|
end
|