gamebox 0.4.0.rc3 → 0.4.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,8 +5,9 @@ module GosuWindowAPI
5
5
 
6
6
  def update
7
7
  millis = Gosu::milliseconds
8
- @last_millis ||= 0
9
- fire :update, (millis - @last_millis)
8
+
9
+ # ignore the first update
10
+ fire :update, (millis - @last_millis) if @last_millis
10
11
  @last_millis = millis
11
12
  end
12
13
 
@@ -63,6 +63,15 @@ module GameboxSpecHelpers
63
63
  end
64
64
  end
65
65
 
66
+ def expects_no_event(target, event_name)
67
+ args = []
68
+ target.when event_name do |*event_args|
69
+ args << event_args
70
+ end
71
+ yield
72
+ args.should be_empty
73
+ end
74
+
66
75
  def expects_event(target, event_name, expected_args=[[]])
67
76
  args = []
68
77
  target.when event_name do |*event_args|
@@ -108,8 +117,14 @@ module GameboxAcceptanceSpecHelpers
108
117
  end
109
118
 
110
119
  def update(millis)
120
+ if @total_millis == 0
121
+ Gosu.stubs(:milliseconds).returns 0
122
+ super()
123
+ end
111
124
  @total_millis += millis
112
125
  Gosu.stubs(:milliseconds).returns @total_millis
126
+ @first_update = false
127
+
113
128
  super()
114
129
  end
115
130
 
@@ -3,7 +3,7 @@ module Gamebox
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
5
  TINY = 0
6
- RC = 3
6
+ RC = 4
7
7
 
8
8
  if RC > 0
9
9
  ARRAY = [MAJOR, MINOR, TINY, "rc#{RC}"]
@@ -20,10 +20,10 @@ describe HookedGosuWindow do
20
20
  end
21
21
 
22
22
  describe "#update" do
23
- it 'fires initial update with full millis' do
23
+ it 'does not fire initial update with full millis' do
24
24
  Gosu.stubs(:milliseconds).returns 58
25
25
 
26
- expects_event subject, :update, [[58]] do
26
+ expects_no_event subject, :update do
27
27
  subject.update
28
28
  end
29
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.rc3
4
+ version: 0.4.0.rc4
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-05-25 00:00:00.000000000 Z
14
+ date: 2012-05-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: gosu