Sha256: 06b8ca17dcd89d75574725bee8f62e21b722a8b8f35c9bdedac5dea456f33f44

Contents?: true

Size: 460 Bytes

Versions: 2

Compression:

Stored size: 460 Bytes

Contents

describe "renaming options" do
  before do
    class Test::Foo
      extend Dry::Initializer::Mixin

      option :foo, as: :bar
    end
  end

  subject { Test::Foo.new foo: :BAZ }

  it "renames the attribute" do
    expect(subject.bar).to eq :BAZ
    expect(subject).not_to respond_to :foo
  end

  it "renames the variable" do
    expect(subject.instance_variable_get(:@bar)).to eq :BAZ
    expect(subject.instance_variable_get(:@foo)).to be_nil
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dry-initializer-0.9.2 spec/renaming_options_spec.rb
dry-initializer-0.9.1 spec/renaming_options_spec.rb