Skip to content

Commit 52afe28

Browse files
authored
Merge pull request #20 from nepalez/v0.0.4
Fix issue #10
2 parents 8ffd22b + fa316d9 commit 52afe28

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/rspec/sqlimit/counter.rb

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def callback
3232
@callback ||= lambda do |_name, start, finish, _message_id, values|
3333
return if %w[CACHE SCHEMA].include? values[:name]
3434
return if cached_query?(values)
35+
3536
queries << {
3637
sql: values[:sql],
3738
duration: (finish - start) * 1_000,

lib/rspec/sqlimit/reporter.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ def initialize(counter)
1111

1212
def call
1313
suffix = " among others (see mark ->)" if @matcher
14-
1514
return "No queries were invoked" if @queries.empty?
1615

1716
<<-MESSAGE.gsub(/ +\|/, "")
@@ -28,7 +27,7 @@ def lines
2827

2928
def line(query, index)
3029
prefix = (matcher && query[:sql] =~ matcher) ? "->" : " "
31-
binds = query[:binds].any? ? "; #{query[:binds]} " : ""
30+
binds = query[:binds]&.any? ? "; #{query[:binds]} " : ""
3231
"#{prefix} #{index + 1}) #{query[:sql]}#{binds}" \
3332
" (#{query[:duration].round(3)} ms)"
3433
end

spec/dummy/db/schema.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema.define(version: 2017_02_11_104800) do
13+
ActiveRecord::Schema.define(version: 20170211104800) do
1414

1515
create_table "users", force: :cascade do |t|
1616
end

0 commit comments

Comments
 (0)