Sha256: 538cabd0f6a92227dc0dcf0082684ebceedcfdf01398ea5301d1a7c640120770

Contents?: true

Size: 1.42 KB

Versions: 6

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

describe( Array ) do
  describe( 'to_s_for_cap' ) do
    context( 'with an element containing white space' ) do
      before( :all ) do
        @list = [ 'one', 'white space', 'three' ]
      end

      it( 'should format the list correctly' ) do
        @list.to_s_for_cap.should == 'one "white space" three'
      end
    end

    context( 'without an element containing white space' ) do
      before( :all ) do
        @list = [ 'one', 'two', 'three' ]
      end
      it( 'should format the list correctly' ) do
        @list.to_s_for_cap.should == 'one two three'
      end
    end
  end
end

describe( String ) do
  describe( 'for_cap_list' ) do
    context( 'with white space' ) do
      before( :all ) do
        @string = 'white space'
      end

      it( 'should format the string correctly' ) do
        @string.for_cap_list.should == '"white space"'
      end
    end

    context( 'without white space' ) do
      before( :all ) do
        @string= 'one'
      end
      it( 'should format the string correctly' ) do
        @string.for_cap_list.should == 'one'
      end
    end
  end

  describe( 'unpack_cap_list' ) do
    it( 'shoud unpack strings in quotes correctly' ) do
      'Item1 "Item 2" Item3'.unpack_cap_list.should == [ "Item1", "Item 2", "Item3" ]
    end

    it( 'should unpack strings correclty' ) do
      'Item1 Item2 Item3'.unpack_cap_list.should == [ "Item1", "Item2", "Item3" ]
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
rcap-1.0.0.rc.4 spec/utilities_spec.rb
rcap-1.0.0.rc.3 spec/utilities_spec.rb
rcap-1.0.0.rc.2 spec/utilities_spec.rb
rcap-1.0.0.rc.1 spec/utilities_spec.rb
rcap-rails-generators-1.3 spec/utilities_spec.rb
rcap-0.4 spec/utilities_spec.rb