Skip to content
This repository
Newer
Older
100644 77 lines (48 sloc) 1.491 kb
f0f4b1e2 »
2009-03-21 (spec) Clock with tick events should cache ClockTicked events.
1 # This is mostly for regression testing and bugfix confirmation at the moment.
2
3 # Prefer local library over installed version.
4 $:.unshift( File.join( File.dirname(__FILE__), "..", "lib" ) )
5 $:.unshift( File.join( File.dirname(__FILE__), "..", "ext", "rubygame" ) )
6
caa0d9dd »
2009-03-21 (spec) Clock with tick events should return ClockTicked events.
7
f0f4b1e2 »
2009-03-21 (spec) Clock with tick events should cache ClockTicked events.
8 require 'rubygame'
9 include Rubygame
caa0d9dd »
2009-03-21 (spec) Clock with tick events should return ClockTicked events.
10 include Rubygame::Events
f0f4b1e2 »
2009-03-21 (spec) Clock with tick events should cache ClockTicked events.
11
12
13 describe Clock do
14
d29c93a6 »
2009-03-21 (spec) Clock should have a yield accessor.
15 before :each do
16 @clock = Clock.new
17 end
18
c1f8527d »
2009-03-21 (spec) Clock w/target should pass frametime, gran, and yield to Clock…
19 after :each do
20 Rubygame.quit
21 end
22
d29c93a6 »
2009-03-21 (spec) Clock should have a yield accessor.
23
559989e5 »
2009-03-21 (spec) Clock should have a granularity accessor.
24 it "should have a granularity accessor" do
25 lambda{@clock.granularity = 5}.should_not raise_error
26 end
27
2c7141af »
2009-04-27 Updated clock_spec.rb (yield -> nice).
28 it "should have a nice accessor" do
29 lambda{@clock.nice = true}.should_not raise_error
d29c93a6 »
2009-03-21 (spec) Clock should have a yield accessor.
30 end
31
32
c1f8527d »
2009-03-21 (spec) Clock w/target should pass frametime, gran, and yield to Clock…
33 describe "with target" do
34
2c7141af »
2009-04-27 Updated clock_spec.rb (yield -> nice).
35 it "should pass frametime, granularity, and nice to Clock.delay" do
c1f8527d »
2009-03-21 (spec) Clock w/target should pass frametime, gran, and yield to Clock…
36 @clock.target_frametime = 1
37 @clock.granularity = 2
2c7141af »
2009-04-27 Updated clock_spec.rb (yield -> nice).
38 @clock.nice = true
c1f8527d »
2009-03-21 (spec) Clock w/target should pass frametime, gran, and yield to Clock…
39
2c7141af »
2009-04-27 Updated clock_spec.rb (yield -> nice).
40 Clock.should_receive(:delay).with(1,2,true).and_return(1)
c1f8527d »
2009-03-21 (spec) Clock w/target should pass frametime, gran, and yield to Clock…
41 @clock.tick
42 end
43
44 end
45
46
f0f4b1e2 »
2009-03-21 (spec) Clock with tick events should cache ClockTicked events.
47 describe "with tick events" do
48
49 before :each do
50 @clock.enable_tick_events
51 end
52
53
caa0d9dd »
2009-03-21 (spec) Clock with tick events should return ClockTicked events.
54 it "should return ClockTicked events" do
55 @clock.tick.should be_instance_of(ClockTicked)
56 end
57
58
f0f4b1e2 »
2009-03-21 (spec) Clock with tick events should cache ClockTicked events.
59 it "should cache ClockTicked events" do
60 Clock.stub!(:delay).and_return(10)
61 # Make sure they are the same exact object
62 @clock.tick.should equal(@clock.tick)
63 end
64
65 end
66
a1776f32 »
2009-03-21 (spec) Clock without tick events should return integer ticks.
67
68 describe "without tick events" do
69
70 it "should return integer ticks" do
71 @clock.tick.should be_instance_of(Fixnum)
72 end
73
74 end
75
f0f4b1e2 »
2009-03-21 (spec) Clock with tick events should cache ClockTicked events.
76 end
Something went wrong with that request. Please try again.