busted 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/lib/busted/counter.rb +11 -7
- data/lib/busted/stack.rb +7 -4
- data/lib/busted/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd3e9b85e09705625f95305d59df190ff2272529
|
4
|
+
data.tar.gz: 63f5c753642f0ba66639fa5f2db9ebe005ecba43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40f8859c48540484bd19f3bf8d3a69a72a090d43a489e71110952893adc32cae1d0454ef0f7ec506f45018db694c300c2ea28c71d876bcbe73428276a405557d
|
7
|
+
data.tar.gz: d1281a70eb28483402ae553455cf4e6cd4d65bb6c5274555a189d005fa82b90758289b46a33c32dab3e9d38ab8025b61fe2b6d81a6423e8b3cee70643e463bd0
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.1
|
data/lib/busted/counter.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "monitor"
|
1
2
|
require "busted/stack"
|
2
3
|
|
3
4
|
module Busted
|
@@ -5,28 +6,31 @@ module Busted
|
|
5
6
|
|
6
7
|
def initialize(stack = Stack.new)
|
7
8
|
@stack = stack
|
9
|
+
@lock = Monitor.new
|
8
10
|
end
|
9
11
|
|
10
12
|
def start
|
11
|
-
stack.started = counts
|
13
|
+
lock.synchronize { stack.started = counts }
|
12
14
|
end
|
13
15
|
|
14
16
|
def finish
|
15
|
-
stack.finished = counts
|
17
|
+
lock.synchronize { stack.finished = counts }
|
16
18
|
end
|
17
19
|
|
18
20
|
def report
|
19
|
-
|
20
|
-
|
21
|
+
lock.synchronize do
|
22
|
+
started = stack.started
|
23
|
+
finished = stack.finished
|
21
24
|
|
22
|
-
|
23
|
-
|
25
|
+
[:method, :constant].each_with_object({}) do |counter, result|
|
26
|
+
result[counter] = finished[counter] - started[counter]
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
27
31
|
private
|
28
32
|
|
29
|
-
attr_reader :stack
|
33
|
+
attr_reader :stack, :lock
|
30
34
|
|
31
35
|
def counts
|
32
36
|
stat = RubyVM.stat
|
data/lib/busted/stack.rb
CHANGED
@@ -1,24 +1,27 @@
|
|
1
|
+
require "monitor"
|
2
|
+
|
1
3
|
module Busted
|
2
4
|
class Stack
|
3
5
|
def initialize
|
4
6
|
@started = []
|
5
7
|
@finished = []
|
8
|
+
@lock = Monitor.new
|
6
9
|
end
|
7
10
|
|
8
11
|
def started
|
9
|
-
@started.pop
|
12
|
+
@lock.synchronize { @started.pop }
|
10
13
|
end
|
11
14
|
|
12
15
|
def started=(element)
|
13
|
-
@started.push element
|
16
|
+
@lock.synchronize { @started.push element }
|
14
17
|
end
|
15
18
|
|
16
19
|
def finished
|
17
|
-
@finished.pop
|
20
|
+
@lock.synchronize { @finished.pop }
|
18
21
|
end
|
19
22
|
|
20
23
|
def finished=(element)
|
21
|
-
@finished.push element
|
24
|
+
@lock.synchronize { @finished.push element }
|
22
25
|
end
|
23
26
|
end
|
24
27
|
end
|
data/lib/busted/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: busted
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simeon F. Willbanks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
|
-
rubygems_version: 2.2.
|
92
|
+
rubygems_version: 2.2.2
|
93
93
|
signing_key:
|
94
94
|
specification_version: 4
|
95
95
|
summary: MRI Ruby defines RubyVM.stat which accesses internal cache counters. When
|