Sha256: fcf29fac9173b12778c96ce511fe98c6044bf295e6a04b156714c991ddacc401

Contents?: true

Size: 1.34 KB

Versions: 10

Compression:

Stored size: 1.34 KB

Contents

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

describe RemoveShapes do
  
  before(:each) do
    @remove_shapes = RemoveShapes.new
  end
  
  it "should have no shapes, unprimed" do
    @remove_shapes.empty?.should == true
  end
  
  describe "add" do
    before(:each) do
      @shapes = stub :shapes
      @remove_shapes.stub! :shapes => @shapes
    end
    it "should << the shape to the shapes" do
      @shapes.should_receive(:<<).once.with :some_shape
      
      @remove_shapes.add :some_shape
    end
  end
  
  describe "remove_from" do
    context 'without shapes' do
      before(:each) do
        @remove_shapes.stub! :empty? => true
      end
      it "should just return" do
        @remove_shapes.should_receive(:shapes).never
        
        @remove_shapes.remove_from stub, stub
      end
    end
    context 'with shapes' do
      before(:each) do
        @shape = stub :shape
        @remove_shapes.stub! :empty? => false, :shapes => [@shape]
      end
      it "should remove the shapes from the environment and the moveables" do
        environment = stub :environment
        moveables   = stub :moveables
        
        environment.should_receive(:remove).once.with @shape
        moveables.should_receive(:remove).once.with @shape
        
        @remove_shapes.remove_from environment, moveables
      end
    end
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gosu_extensions-0.2.9 spec/lib/core/remove_shapes_spec.rb
gosu_extensions-0.2.8 spec/lib/core/remove_shapes_spec.rb
gosu_extensions-0.2.7 spec/lib/core/remove_shapes_spec.rb
gosu_extensions-0.2.6 spec/lib/core/remove_shapes_spec.rb
gosu_extensions-0.2.5 spec/lib/core/remove_shapes_spec.rb
gosu_extensions-0.2.4 spec/lib/core/remove_shapes_spec.rb
gosu_extensions-0.2.3 spec/lib/core/remove_shapes_spec.rb
gosu_extensions-0.2.2 spec/lib/core/remove_shapes_spec.rb
gosu_extensions-0.2.1 spec/lib/core/remove_shapes_spec.rb
gosu_extensions-0.2.0 spec/lib/core/remove_shapes_spec.rb