Sha256: c93cdb66779c49c9b4fa43801525b784f0fa9e29f52bd0882a3e36f3f4206db8

Contents?: true

Size: 948 Bytes

Versions: 1

Compression:

Stored size: 948 Bytes

Contents

require 'page_magic/utils/string'
module PageMagic
  module Utils
    describe String do
      describe '.classify' do
        context 'parameter is symbol' do
          it 'returns a string' do
            expect(described_class.classify(:Symbol)).to eq('Symbol')
          end
        end

        context 'parameter is string' do
          it 'returns a string' do
            expect(described_class.classify(:String)).to eq('String')
          end
        end

        context 'single word' do
          context 'first letter is lower case' do
            it 'converts the first letter to uppercase' do
              expect(described_class.classify(:symbol)).to eq('Symbol')
            end
          end
        end

        context 'snakecase' do
          it 'removes underscores and capitalises each word' do
            expect(described_class.classify(:snake_case)).to eq('SnakeCase')
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
page_magic-1.2.9 spec/page_magic/utils/string_spec.rb