Sha256: b7e370e4be60457708bb3cb95048f6d69a27898fe9291bac164e5930e8fd12dd

Contents?: true

Size: 723 Bytes

Versions: 8

Compression:

Stored size: 723 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Normalizy::Config, '#alias' do
  it 'accepts alias' do
    Normalizy.configure do |config|
      config.alias :email, :downcase
    end

    expect(Alias.create(email: 'Botelho').email).to eq 'botelho'
  end

  it 'accepts alias with options' do
    Normalizy.configure do |config|
      config.alias :with_arg, strip: { side: :left }
    end

    expect(Alias.create(with_arg_field: '  trim').with_arg_field).to eq 'trim'
  end

  it 'accepts late options' do
    Normalizy.configure do |config|
      config.alias :with_inline_arg, :strip
    end

    expect(Alias.create(with_inline_arg_field: '  trim').with_inline_arg_field).to eq 'trim'
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
normalizy-1.5.0 spec/normalizy/config/alias_spec.rb
normalizy-1.4.0 spec/normalizy/config/alias_spec.rb
normalizy-1.3.0 spec/normalizy/config/alias_spec.rb
normalizy-1.2.0 spec/normalizy/config/alias_spec.rb
normalizy-1.1.1 spec/normalizy/config/alias_spec.rb
normalizy-1.1.0 spec/normalizy/config/alias_spec.rb
normalizy-1.0.1 spec/normalizy/config/alias_spec.rb
normalizy-1.0.0 spec/normalizy/config/alias_spec.rb