Sha256: fd186bd7d161d3437aaf1bddabeecfd9b27ba1cc4274bc8c7d45914a6ee285a8

Contents?: true

Size: 427 Bytes

Versions: 3

Compression:

Stored size: 427 Bytes

Contents

describe "assignment by model" do
  before do
    class Test::Order
      extend Dry::Initializer

      param  :user,    model: "User"
      option :product, model: Item
    end
  end

  let!(:user) { User.create name: "Dude" }
  let!(:item) { Item.create name: "The thing" }

  it "works" do
    subject = Test::Order.new(nil, product: nil)

    expect(subject.user).to be_nil
    expect(subject.product).to be_nil
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-initializer-rails-3.1.1 spec/dry/initializer/assignment_by_nil_spec.rb
dry-initializer-rails-3.1.0 spec/dry/initializer/assignment_by_nil_spec.rb
dry-initializer-rails-3.0.0 spec/dry/initializer/assignment_by_nil_spec.rb