Sha256: e3c22c2406da1d969b61889b6c827c7b2264aef1410e38ce63e0741c124987ac

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

require File.join(File.dirname(__FILE__), '/../../spec_helper')

describe GameWindow do
  
  class Gosu::Window
    def initialize(*)
      # Note: Let's not initialize a real window.
    end
  end
  
  class GameWindowTest < GameWindow
    def setup_font
      # Note: Causes errors, test separately.
    end
  end
  
  before(:each) do
    @window = GameWindowTest.new
  end
  
  describe "gravity_vector" do
    context 'default' do
      it "should have a calculated value" do
        @window.gravity_vector.x.should == 0.0
        @window.gravity_vector.y.should == 0.098
      end
    end
    context 'user defined' do
      before(:each) do
        GameWindowTest.class_eval do
          gravity 100
        end
        @window = GameWindowTest.new
      end
      it "should have a user defined value" do
        @window.gravity_vector.x.should == 0.0
        @window.gravity_vector.y.should == 10.0
      end
    end
  end
  
  describe "draw" do
    it "should call other draw methods in sequence" do
      @window.should_receive(:draw_background).once.with
      @window.should_receive(:draw_ambient).once.with
      @window.should_receive(:draw_moveables).once.with
      @window.should_receive(:draw_ui).once.with
      
      @window.draw
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gosu_extensions-0.1.17 spec/lib/core/game_window_spec.rb