28 lines
807 B
Ruby
28 lines
807 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "Home" do
|
|
describe "GET /" do
|
|
it "returns a successful response" do
|
|
get root_path
|
|
|
|
expect(response).to have_http_status(:ok)
|
|
expect(response.body).to include("Car Tracker")
|
|
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
|
|
end
|