Sha256: 9c7b1dfa6d0d798dc47cbb1ce565441707ba6695a8fbf846bf93e885b545f262

Contents?: true

Size: 791 Bytes

Versions: 6

Compression:

Stored size: 791 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Normalizy::Filters::Slug do
  describe 'default options' do
    it { expect(subject.call(nil)).to eq nil }
    it { expect(subject.call('')).to  eq '' }

    it { expect(subject.call('The Title')).to eq 'the-title' }
  end

  describe 'to' do
    it { expect(subject.call(nil        , to: :slug)).to eq nil }
    it { expect(subject.call(''         , to: :slug)).to eq '' }
    it { expect(subject.call('The Title', to: :slug)).to eq 'the-title' }

    context 'when is not :to key' do
      it { expect(subject.call(nil        , from: :slug)).to eq nil }
      it { expect(subject.call(''         , from: :slug)).to eq '' }
      it { expect(subject.call('The Title', from: :slug)).to eq 'the-title' }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
normalizy-1.5.0 spec/normalizy/filters/slug_spec.rb
normalizy-1.4.0 spec/normalizy/filters/slug_spec.rb
normalizy-1.3.0 spec/normalizy/filters/slug_spec.rb
normalizy-1.2.0 spec/normalizy/filters/slug_spec.rb
normalizy-1.1.1 spec/normalizy/filters/slug_spec.rb
normalizy-1.1.0 spec/normalizy/filters/slug_spec.rb