Sha256: 9149bf7206d5de5aa598ae7db0037972b6b95c0f828fb798db906b6c966d4ab1

Contents?: true

Size: 1.01 KB

Versions: 34

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

RSpec.shared_examples_for "default_price" do
  let(:model)        { described_class }
  subject(:instance) { FactoryBot.build(model.name.demodulize.downcase.to_sym) }

  describe '.has_one :default_price' do
    let(:default_price_association) { model.reflect_on_association(:default_price) }

    it 'should be a has one association' do
      expect(default_price_association.macro).to eql :has_one
    end

    it 'should have a dependent destroy' do
      expect(default_price_association.options[:dependent]).to eql :destroy
    end

    it 'should have the class name of Spree::Price' do
      expect(default_price_association.options[:class_name]).to eql 'Spree::Price'
    end
  end

  describe '#default_price' do
    subject { instance.default_price }

    describe '#class' do
      subject { super().class }
      it { is_expected.to eql Spree::Price }
    end
  end

  describe '#has_default_price?' do
    subject { super().has_default_price? }
    it { is_expected.to be_truthy }
  end
end

Version data entries

34 entries across 34 versions & 2 rubygems

Version Path
solidus_core-2.8.6 spec/support/concerns/default_price.rb
solidus_core-2.6.6 spec/support/concerns/default_price.rb
solidus_core-2.7.4 spec/support/concerns/default_price.rb
solidus_core-2.8.5 spec/support/concerns/default_price.rb
solidus_core-2.7.3 spec/support/concerns/default_price.rb
solidus_core-2.6.5 spec/support/concerns/default_price.rb
solidus_core-2.8.4 spec/support/concerns/default_price.rb
solidus_core-2.8.3 spec/support/concerns/default_price.rb
solidus_core-2.7.2 spec/support/concerns/default_price.rb
solidus_core-2.6.4 spec/support/concerns/default_price.rb
solidus_core-2.8.2 spec/support/concerns/default_price.rb
solidus_core-2.8.1 spec/support/concerns/default_price.rb
solidus_core-2.6.3 spec/support/concerns/default_price.rb
solidus_core-2.8.0 spec/support/concerns/default_price.rb
solidus_core-2.7.1 spec/support/concerns/default_price.rb
solidus_core-2.6.2 spec/support/concerns/default_price.rb
solidus_core_devise_token_auth-2.8.0.alpha.14 spec/support/concerns/default_price.rb
solidus_core_devise_token_auth-2.8.0.alpha.13 spec/support/concerns/default_price.rb
solidus_core_devise_token_auth-2.8.0.alpha.12 spec/support/concerns/default_price.rb
solidus_core_devise_token_auth-2.8.0.alpha.11 spec/support/concerns/default_price.rb