Sha256: ddb30cab83e7e054dbd352ddc39c58c5d30cab61a7a5ca287d1839eb187e9c0b

Contents?: true

Size: 477 Bytes

Versions: 3

Compression:

Stored size: 477 Bytes

Contents

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

      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(user, product: item)

    expect(subject.user).to eql user
    expect(subject.product).to eql item
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-initializer-rails-0.0.3 spec/dry/initializer/assignment_by_model_spec.rb
dry-initializer-rails-0.0.2 spec/dry/initializer/assignment_by_model_spec.rb
dry-initializer-rails-0.0.1 spec/dry/initializer/assignment_by_model_spec.rb