query_diet 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,9 @@ module QueryDiet
10
10
  end
11
11
 
12
12
  def log(query)
13
- unless paused?
13
+ if paused?
14
+ yield
15
+ else
14
16
  result = nil
15
17
  time = Benchmark.realtime do
16
18
  result = yield
@@ -1,3 +1,3 @@
1
1
  module QueryDiet
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
@@ -51,6 +51,10 @@ describe QueryDiet::Logger do
51
51
 
52
52
  describe "#paused" do
53
53
 
54
+ after :each do
55
+ QueryDiet::Logger.paused = false
56
+ end
57
+
54
58
  it "should be false by default" do
55
59
  QueryDiet::Logger.paused.should be_false
56
60
  end
@@ -69,6 +73,19 @@ describe QueryDiet::Logger do
69
73
  QueryDiet::Logger.count.should == 3
70
74
  end
71
75
 
76
+ # regression
77
+ it "should still execute queries if paused" do
78
+ Movie.delete_all
79
+ QueryDiet::Logger.paused = true
80
+ Movie.count.should == 0
81
+ Movie.create
82
+ Movie.count.should == 1
83
+ end
84
+
85
+ it "should be false by default" do
86
+ QueryDiet::Logger.paused.should be_false
87
+ end
88
+
72
89
  end
73
90
 
74
91
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: query_diet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 0
10
- version: 0.5.0
9
+ - 1
10
+ version: 0.5.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henning Koch