Sha256: f73c8f0db0c677fa04ca47545dae28cdc9c0a8f7ac61d98303be7b503fc0a063

Contents?: true

Size: 1.31 KB

Versions: 6

Compression:

Stored size: 1.31 KB

Contents

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

describe UserInterface do
  
  before(:each) do
    @window = stub :window
    @user_interface = test_class_with(UserInterface).new @window
  end
  
  describe "ui" do
    before(:each) do
      @font = stub :font, :null_object => true
      @window.stub! :font => @font
      @window.stub! :register_ui
    end
    it "should register itself with window" do
      @window.should_receive(:register_ui).once.with @user_interface
      
      @user_interface.ui
    end
    it "should install a method draw_ui" do
      @user_interface.ui do end
      
      lambda { @user_interface.draw_ui }.should_not raise_error
    end
    it "should do the right thing on calling draw_ui (defaults)" do
      some_block = lambda { :some_result }
      @user_interface.ui &some_block
      
      @font.should_receive(:draw).once.with :some_result, 20, 10, Layer::UI, 1.0, 1.0, Gosu::Color::BLACK
      
      @user_interface.draw_ui 
    end
    it "should do the right thing on calling draw_ui" do
      some_block = lambda { :some_result }
      @user_interface.ui :some_x, :some_y, :some_color, &some_block
      
      @font.should_receive(:draw).once.with :some_result, :some_x, :some_y, Layer::UI, 1.0, 1.0, :some_color
      
      @user_interface.draw_ui 
    end
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gosu_extensions-0.2.9 spec/lib/traits/user_interface_spec.rb
gosu_extensions-0.2.8 spec/lib/traits/user_interface_spec.rb
gosu_extensions-0.2.7 spec/lib/traits/user_interface_spec.rb
gosu_extensions-0.2.6 spec/lib/traits/user_interface_spec.rb
gosu_extensions-0.2.5 spec/lib/traits/user_interface_spec.rb
gosu_extensions-0.2.4 spec/lib/traits/user_interface_spec.rb