2022-07-18 07:51:03 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "rails_helper"
|
|
|
|
|
|
|
|
describe AboutController, type: :controller do
|
2024-08-10 20:25:07 -07:00
|
|
|
describe "#index" do
|
|
|
|
subject { get :index }
|
|
|
|
|
|
|
|
context "advanced layout is enabled" do
|
|
|
|
before do
|
|
|
|
allow(APP_CONFIG).to receive(:dig).with(:features, :advanced_frontpage, :enabled).and_return(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "renders the correct template" do
|
|
|
|
subject
|
|
|
|
expect(response).to render_template("about/index_advanced")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "advanced layout is disabled" do
|
|
|
|
before do
|
|
|
|
allow(APP_CONFIG).to receive(:dig).with(:features, :advanced_frontpage, :enabled).and_return(false)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "renders the correct template" do
|
|
|
|
subject
|
|
|
|
expect(response).to render_template("about/index")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2022-07-18 07:51:03 -07:00
|
|
|
describe "#about" do
|
|
|
|
subject { get :about }
|
|
|
|
|
2022-07-18 13:27:31 -07:00
|
|
|
before(:each) do
|
2022-07-18 07:51:03 -07:00
|
|
|
FactoryBot.create(:user, { confirmed_at: Time.current, answered_count: 1 })
|
|
|
|
FactoryBot.create(:user, { confirmed_at: Time.current, answered_count: 1 }).ban
|
|
|
|
FactoryBot.create(:user, { confirmed_at: Time.current })
|
|
|
|
FactoryBot.create(:user, { confirmed_at: Time.current }).ban
|
2022-07-18 13:27:31 -07:00
|
|
|
end
|
2022-07-18 07:51:03 -07:00
|
|
|
|
|
|
|
it "shows the correct user count" do
|
|
|
|
subject
|
|
|
|
expect(assigns(:users)).to eq(1)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|