Sha256: 30e7d4a670ec70ade3284c51cdfb29256ba990284b0863bbf417f974e6542767

Contents?: true

Size: 1.26 KB

Versions: 14

Compression:

Stored size: 1.26 KB

Contents

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

describe Attachable do
  
  before(:each) do
    @attachable = test_class_with(Attachable).new stub(:window)
  end
  
  describe "move_relative" do
    before(:each) do
      @attachable.stub! :relative_position => "+ attachable position", :position= => nil, :rotation= => nil
      @pod = stub :pod, :position => "pod position ", :rotation => :some_rotation
    end
    it "should set the position to the pod's position plus the relative position" do
      @attachable.should_receive(:position=).once.with "pod position + attachable position"
      
      @attachable.move_relative @pod
    end
    it "should set the rotation to the pod's rotation" do
      @attachable.should_receive(:rotation=).once.with :some_rotation
      
      @attachable.move_relative @pod
    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

14 entries across 14 versions & 1 rubygems

Version Path
gosu_extensions-0.1.24 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.23 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.22 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.21 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.20 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.19 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.18 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.17 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.16 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.15 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.14 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.13 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.12 spec/lib/traits/attachable_spec.rb
gosu_extensions-0.1.11 spec/lib/traits/attachable_spec.rb