Sha256: fdcedb93f1296a2537be8142c21b34df2ddb75a13a0820311cafbb15957ed8a7

Contents?: true

Size: 1.24 KB

Versions: 7

Compression:

Stored size: 1.24 KB

Contents

share_as :CoordinateTargetShared do
  before :each do
    @dir = dir_class.new(100)
  end
  include DirectionShared
  it 'should have an accessible target, based on the constructor argument' do
    @dir.respond_to?(:target).should == true
    @dir.target.should == 100
  end
  it 'should be constructed with at least a target parameter' do
    lambda { dir_class.new }.should raise_error
    lambda { dir_class.new 45 }.should_not raise_error
    lambda { dir_class.new 45, true }.should_not raise_error
  end
  it 'should be relative if constructed with a false third parameter' do
    direction = dir_class.new(45, false)
    direction.absolute?.should == false
  end
  it 'should be absolute if constructed with a true third parameter' do
    direction = dir_class.new(45, true)
    direction.absolute?.should == true
  end
  it 'should be absolute if constructed with only two parameters' do
    direction = dir_class.new(45)
    direction.absolute?.should == true
  end
  describe '#to_command' do
    it 'should have exactly 1 numerical parameter' do
      extract_coordinates(@dir.to_command).length.should == 1
    end
    it 'should show the provided X value as the next parameter' do
      extract_coordinates(@dir.to_command)[0].should == 100
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
savage-1.1.0 spec/shared/coordinate_target.rb
savage-1.0.3 spec/shared/coordinate_target.rb
savage-1.0.2 spec/shared/coordinate_target.rb
savage-1.0.1 spec/shared/coordinate_target.rb
savage-1.0.0 spec/shared/coordinate_target.rb
savage-0.2.0 spec/shared/coordinate_target.rb
savage-0.1.0 spec/shared/coordinate_target.rb