Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Aug 12, 2024
1 parent 266a1c8 commit 9002f06
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $ gem install sql_matchers

```ruby
it 'should assert query count' do
expect { User.count }.to match_query(count: 1)
expect { User.find_by(id: 1) }.to match_query(count: 1)
end

it 'should assert query matches' do
Expand All @@ -59,8 +59,14 @@ it 'should assert query matches' do
end

it 'should assert SQL matches' do
# match_sql will attempt to normalize formatting to prevent false-negatives
expect(User.where(id: 42).to_sql).to match_sql <<~SQL.squish
SELECT "users".* FROM "users" WHERE "users"."id" = 42
SELECT
"users".*
FROM
"users"
WHERE
"users"."id" = 42
SQL
end
```
Expand Down

0 comments on commit 9002f06

Please sign in to comment.