Sha256: 9526e4d3deeb1bcc6d060eb9fa0bb4ebbbe1bafe0ac325990a163567052aeb97
Contents?: true
Size: 1.1 KB
Versions: 16
Compression:
Stored size: 1.1 KB
Contents
require 'spec_helper' module Spree module Stock describe ContentItem, type: :model do let(:variant) { build(:variant, weight: 25.0) } subject { ContentItem.new(build(:inventory_unit, variant: variant)) } describe 'Delegations' do it { is_expected.to delegate_method(:line_item).to(:inventory_unit) } it { is_expected.to delegate_method(:variant).to(:inventory_unit) } it { is_expected.to delegate_method(:dimension).to(:variant).with_prefix } it { is_expected.to delegate_method(:price).to(:variant) } it { is_expected.to delegate_method(:volume).to(:variant).with_prefix } it { is_expected.to delegate_method(:weight).to(:variant).with_prefix } end context "#volume" do it "calculate the total volume of the variant" do expect(subject.volume).to eq variant.volume * subject.quantity end end context "#dimension" do it "calculate the total dimension of the variant" do expect(subject.dimension).to eq variant.dimension * subject.quantity end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems