Sha256: 1e152fc23059ed5bae5bdc19f0e9ec88a3fbca48be91024c9f681e07791e8845

Contents?: true

Size: 776 Bytes

Versions: 3

Compression:

Stored size: 776 Bytes

Contents

require 'spec_helper'

describe WrapIt::HTMLData do
  describe 'self.sanitize' do
    it { expect(described_class.sanitize).to eq ({}) }

    it 'stringifies values' do
      expect(described_class.sanitize(test: 1, subj: 2))
        .to eq(test: '1', subj: '2')
    end

    it 'splits dashed keys' do
      expect(described_class.sanitize(:'test-me-now' => 1, subj: 2))
        .to eq(test: {me: {now: '1'}}, subj: '2')
    end

    it 'parses nested hash' do
      expect(described_class.sanitize(test: {:'me-now' => 1}, subj: 2))
        .to eq(test: {me: {now: '1'}}, subj: '2')
    end

    it 'removes bogous symbols from keys' do
      expect(described_class.sanitize(test: {:'me_n%ow' => 1}, subj: 2))
        .to eq(test: {me_now: '1'}, subj: '2')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wrap_it-1.0.2 spec/lib/html_data_spec.rb
wrap_it-1.0.1 spec/lib/html_data_spec.rb
wrap_it-1.0.0 spec/lib/html_data_spec.rb