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

Implicitly assert no exception is raised in assert_queries & al #44484

Merged
merged 1 commit into from Feb 19, 2022

Conversation

byroot
Copy link
Member

@byroot byroot commented Feb 19, 2022

Fix: #44397
Ref: #37313
Ref: #42459

This avoid mistakes such as:

assert_raise Something do
  assert_queries(1) do
    raise Something
  end
end

Fix: #44397
Ref: #37313
Ref: #42459

This avoid mistakes such as:

```ruby
assert_raise Something do
  assert_queries(1) do
    raise Something
  end
end
```

Co-Authored-By: Alex Coomans <alexc@squareup.com>
@@ -489,9 +489,11 @@ def test_query_cache_does_not_allow_sql_key_mutation
payload[:sql].downcase!
end

assert_raises FrozenError do
ActiveRecord::Base.cache do
assert_queries(1) { Task.find(1); Task.find(1) }
Copy link
Member Author

Choose a reason for hiding this comment

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

It's not quite clear what this was testing.

@byroot byroot merged commit ce1806d into main Feb 19, 2022
@byroot byroot deleted the sql-assertions branch February 19, 2022 08:23
rafaelfranca pushed a commit that referenced this pull request Feb 25, 2022
Implicitly assert no exception is raised in `assert_queries` & al
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant