Sha256: 9f7aeabc4c1a3f4ff1bc3430b7a08b5a807196d7eddf768fd4273e722534a414

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

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

describe Attachable do
  
  before(:each) do
    @window = stub :window, :things => []
    @pod = stub :pod, :relative_position => :relative_position, :rotation => :some_rotation
    @attachable = test_class_with(Attachable).new @window
    @attachable.pod = @pod
  end
  
  describe "move_relative" do
    before(:each) do
      @attachable.stub! :position= => nil, :rotation= => nil
    end
    it "should set the position to the pod's position plus the relative position" do
      @attachable.should_receive(:position=).once.with :relative_position
      
      @attachable.move_relative
    end
    it "should set the rotation to the pod's rotation" do
      @attachable.should_receive(:rotation=).once.with :some_rotation
      
      @attachable.move_relative
    end
  end
  
  describe "relative_position" do
    it "should be a writer" do
      lambda { @attachable.relative_position = :some_position }.should_not raise_error
    end
    it "should have a reader" do
      lambda { @attachable.relative_position }.should_not raise_error
    end
    it "should read what is written" do
      @attachable.relative_position = :some_position
      @attachable.relative_position.should == :some_position
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gosu_extensions-0.3.3 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.3.2 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.3.1 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.3.0 spec/lib/traits/attachable_spec.rb