Sha256: 30acbfdbfa40a06652856ce269e3cf7d6b9166a47a97cf96894d5d5d2bd96509

Contents?: true

Size: 415 Bytes

Versions: 6

Compression:

Stored size: 415 Bytes

Contents

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

      option :"some foo", as: :bar
    end
  end

  subject { Test::Foo.new "some 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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-initializer-1.0.0 spec/renaming_options_spec.rb
dry-initializer-0.11.0 spec/renaming_options_spec.rb
dry-initializer-0.10.2 spec/renaming_options_spec.rb
dry-initializer-0.10.1 spec/renaming_options_spec.rb
dry-initializer-0.10.0 spec/renaming_options_spec.rb
dry-initializer-0.9.3 spec/renaming_options_spec.rb