mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
- presence: true is redundant since Rails 5.0 BUT applies with new default config of belongs_to_required_by_default to true. Lots of files with belongs_to_required_by_default = false (backward compatibility). So: deleting this setting implies to adding optional: true
20 lines
448 B
Ruby
20 lines
448 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
RSpec.describe SubscriptionLineItem, model: true do
|
|
describe "validations" do
|
|
it "requires a subscription" do
|
|
expect(subject).to belong_to :subscription
|
|
end
|
|
|
|
it "requires a variant" do
|
|
expect(subject).to belong_to :variant
|
|
end
|
|
|
|
it "requires a integer for quantity" do
|
|
expect(subject).to validate_numericality_of(:quantity).only_integer
|
|
end
|
|
end
|
|
end
|