busted 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 988c396e54ce313e0340a3cf81235f3572dfb8c5
4
- data.tar.gz: e714740003083eb282666197a7bf33d9a1e51b09
3
+ metadata.gz: cd3e9b85e09705625f95305d59df190ff2272529
4
+ data.tar.gz: 63f5c753642f0ba66639fa5f2db9ebe005ecba43
5
5
  SHA512:
6
- metadata.gz: a94d468be6ace8ceef4f9269fc73aebeee1443d95ad4d2eca88162f7d6ab2fb6737d5c094d39800d3e1bb691d093b0b5f60236c0affc10704cb26609e8525e11
7
- data.tar.gz: 4c509f67c7f2f1aa1e8362f8e56a9595c1c2f06805c815c2b4387b5be31ef2f6dbce15e7d76b7a267ba1f61b6c475b936722da11edda361cff94635105bd13e1
6
+ metadata.gz: 40f8859c48540484bd19f3bf8d3a69a72a090d43a489e71110952893adc32cae1d0454ef0f7ec506f45018db694c300c2ea28c71d876bcbe73428276a405557d
7
+ data.tar.gz: d1281a70eb28483402ae553455cf4e6cd4d65bb6c5274555a189d005fa82b90758289b46a33c32dab3e9d38ab8025b61fe2b6d81a6423e8b3cee70643e463bd0
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.1.1
@@ -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
- started = stack.started
20
- finished = stack.finished
21
+ lock.synchronize do
22
+ started = stack.started
23
+ finished = stack.finished
21
24
 
22
- [:method, :constant].each_with_object({}) do |counter, result|
23
- result[counter] = finished[counter] - started[counter]
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
@@ -1,3 +1,3 @@
1
1
  module Busted
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
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.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-01-05 00:00:00.000000000 Z
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.0
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