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 CHANGED
@@ -17,6 +17,8 @@ And then execute:
17
17
  $ bundle
18
18
  ```
19
19
 
20
+ Support for rspec versions 2 and 3
21
+
20
22
  ## Usage
21
23
 
22
24
  Add to your ```spec/spec_helper.rb```
@@ -6,12 +6,22 @@ module Rspec
6
6
  query_count(&block) == expected
7
7
  end
8
8
 
9
- failure_message_for_should do |actual|
10
- "Expected to run exactly #{expected} queries, got #{@counter.query_count}"
11
- end
9
+ if self.respond_to?(:failure_message)
10
+ failure_message do |actual|
11
+ failure_text
12
+ end
12
13
 
13
- failure_message_for_should_not do |actual|
14
- "Expected to run other than #{expected} queries, got #{@counter.query_count}"
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
@@ -1,5 +1,5 @@
1
1
  module Rspec
2
2
  module QueryLimit
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  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.0
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-07-22 00:00:00.000000000 Z
12
+ date: 2014-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec-rails