Sha256: 455f7c5bd6d4f754f849cbdfe2df50f5183712427f1e7c7be998365171abf91c

Contents?: true

Size: 933 Bytes

Versions: 3

Compression:

Stored size: 933 Bytes

Contents

require 'device_map'

RSpec.describe DeviceMap::Keyword do
  describe '.normalize' do
    it 'strips all non-alphanumeric characters' do
      normalized_keywords = described_class.normalize ['test-123', 'test_123']
      expect(normalized_keywords).to eq ['test123', 'test123']
    end

    it 'convers all characters to lower case' do
      normalized_keywords = described_class.normalize ['Test', 'TEST']
      expect(normalized_keywords).to eq ['test', 'test']
    end

    example do
      normalized_keywords = described_class.normalize ['[Bb]lack.?[Bb]erry']
      expect(normalized_keywords).to eq ['blackberry']
    end
  end

  describe '.join' do
    example do
      joined_keywords = described_class.join ['test', '123']
      expect(joined_keywords).to eq 'test123'
    end

    example do
      joined_keywords = described_class.join ['test', 'test123']
      expect(joined_keywords).to eq 'test123'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
device_map-0.1.2 spec/keyword_spec.rb
device_map-0.1.1 spec/keyword_spec.rb
device_map-0.1.0 spec/keyword_spec.rb