Sha256: 9df78f2d907cb758758d13ee623abbc8b791108674aa57197ab8bba8ff1daccb

Contents?: true

Size: 951 Bytes

Versions: 5

Compression:

Stored size: 951 Bytes

Contents

shared_examples "Direction" do
  include Command
  it 'should have a to_command method' do
    @dir.respond_to?(:to_command).should == true
  end
  it 'should have an absolute? method' do
    @dir.respond_to?(:absolute?).should == true
  end
  it 'should have a command_code method' do
    @dir.respond_to?(:command_code).should == true
  end
  describe '#to_command' do
    it "should start with the command\'s command code" do
      @dir.to_command[0,1].should == @dir.command_code
    end
    it 'should only have one alphabetical command code' do
      @dir.to_command.match(/[A-Za-z]/).size.should == 1
    end
  end
  describe '#command_code' do
    it 'should start with a lower-case letter when not absolute' do
      rel_dir = create_relative
      rel_dir.command_code.should == command_code.downcase
    end
    it 'should start with a capital letter when absolute' do
      @dir.command_code.should == command_code.upcase
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
savage-transform-1.3.0 spec/shared/direction.rb
text2path-0.0.2 lib/ext/savage/spec/shared/direction.rb
text2path-0.0.1 lib/ext/savage/spec/shared/direction.rb
savage-1.2.0 spec/shared/direction.rb
savage-1.1.8 spec/shared/direction.rb