rspec-query-limit 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/lib/rspec/query_limit/matchers.rb +22 -5
- data/lib/rspec/query_limit/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -6,12 +6,22 @@ module Rspec
|
|
6
6
|
query_count(&block) == expected
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
if self.respond_to?(:failure_message)
|
10
|
+
failure_message do |actual|
|
11
|
+
failure_text
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
failure_message_when_negated do |actual|
|
15
|
+
failure_text_negated
|
16
|
+
end
|
17
|
+
else
|
18
|
+
failure_message_for_should do |actual|
|
19
|
+
failure_text
|
20
|
+
end
|
21
|
+
|
22
|
+
failure_message_for_should_not do |actual|
|
23
|
+
failure_text_negated
|
24
|
+
end
|
15
25
|
end
|
16
26
|
|
17
27
|
def query_count(&block)
|
@@ -24,6 +34,13 @@ module Rspec
|
|
24
34
|
true
|
25
35
|
end
|
26
36
|
|
37
|
+
def failure_text
|
38
|
+
"Expected to run exactly #{expected} queries, got #{@counter.query_count}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def failure_text_negated
|
42
|
+
"Expected to run other than #{expected} queries, got #{@counter.query_count}"
|
43
|
+
end
|
27
44
|
end
|
28
45
|
end
|
29
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-query-limit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec-rails
|