require "rails_helper" RSpec.describe "Home" do describe "GET /" do before { identify_user } it "returns the vehicle index" do get root_path expect(response).to have_http_status(:ok) expect(response.body).to include("Vehicles") expect(response.body).to include("stylesheet") expect(response.body).to include("importmap") end it "renders successfully when a content security policy is configured" do original_policy = Rails.application.config.content_security_policy Rails.application.config.content_security_policy do |policy| policy.default_src :self end get root_path expect(response).to have_http_status(:ok) ensure Rails.application.config.instance_variable_set(:@content_security_policy, original_policy) end end def identify_user(user = create(:user)) access_key = AccessKey.current post session_path, params: { name: user.name, email: user.email, key: access_key.raw_key } end end