Skip to content

Commit

Permalink
fix query matcher order of operations
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Mar 26, 2024
1 parent dc7f21d commit af747b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions spec/support/matchers/query_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ def supports_value_expectations? = true
def matches?(block)
@queries = QueryLogger.log(&block)

if @block
@block.call(@queries)
end

@queries.size == @count
@queries.size == @count && (
@block.nil? || @block.call(@queries)
)
end

def failure_message
Expand Down
4 changes: 2 additions & 2 deletions spec/support/matchers/sql_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
diffable

match do |actual|
@expected = formatter.format(+expected)
@actual = formatter.format(+actual)
@expected = formatter.format(+expected.to_s)
@actual = formatter.format(+actual.to_s)

@actual == @expected
end
Expand Down

0 comments on commit af747b0

Please sign in to comment.