Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GovukContentSecurityPolicy test #324

Merged
merged 1 commit into from Oct 5, 2023
Merged

Fix GovukContentSecurityPolicy test #324

merged 1 commit into from Oct 5, 2023

Conversation

AgaDufrat
Copy link
Contributor

The test started failing because Rails now prevents meaningless assignments to a configuration key by raising NoMethodError. See: rails/rails@265bfad

  GovukContentSecurityPolicy.configure creates a policy
     Failure/Error: Rails.application.config.content_security_policy = nil

     NoMethodError:
       Cannot assign to `content_security_policy`, it is a configuration method

                   raise NoMethodError.new("Cannot assign to `#{key}`, it is a configuration method")
                   ^^^^^
     # ./spec/lib/govuk_content_security_policy_spec.rb:14:in `block (3 levels) in <top (required)>'

The test started failing because Rails now prevents meaningless assignments to
a configuration key by raising NoMethodError.  See:
rails/rails@265bfad

```
  GovukContentSecurityPolicy.configure creates a policy
     Failure/Error: Rails.application.config.content_security_policy = nil

     NoMethodError:
       Cannot assign to `content_security_policy`, it is a configuration method

                   raise NoMethodError.new("Cannot assign to `#{key}`, it is a configuration method")
                   ^^^^^
     # ./spec/lib/govuk_content_security_policy_spec.rb:14:in `block (3 levels) in <top (required)>'
```
Copy link
Contributor

@robinjam robinjam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better!

@AgaDufrat AgaDufrat merged commit 4e81e17 into main Oct 5, 2023
5 checks passed
@AgaDufrat AgaDufrat deleted the fix-test branch October 5, 2023 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants