Sha256: cc32fdd88e865eb6579a32e598b0570bc8933fc4a201a95a74738321152ce9c5

Contents?: true

Size: 816 Bytes

Versions: 7

Compression:

Stored size: 816 Bytes

Contents

# frozen_string_literal: true

RSpec.describe PageMagic::Utils::String do
  describe '.classify' do
    context 'when parameter is symbol' do
      it 'returns a string' do
        expect(described_class.classify(:Symbol)).to eq('Symbol')
      end
    end

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

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
page_magic-2.0.6 spec/page_magic/utils/string_spec.rb
page_magic-2.0.5 spec/page_magic/utils/string_spec.rb
page_magic-2.0.4 spec/page_magic/utils/string_spec.rb
page_magic-2.0.3 spec/page_magic/utils/string_spec.rb
page_magic-2.0.2 spec/page_magic/utils/string_spec.rb
page_magic-2.0.1 spec/page_magic/utils/string_spec.rb
page_magic-2.0.0 spec/page_magic/utils/string_spec.rb