Sha256: 846bcf180042d385550be2b5924d62a111d70bf48801858f94483d8d7be711a9

Contents?: true

Size: 860 Bytes

Versions: 6

Compression:

Stored size: 860 Bytes

Contents

shared_examples_for "default_price" do
  let(:model)        { described_class }
  subject(:instance) { FactoryGirl.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 }

    its(:class) { should eql Spree::Price }
  end

  its(:has_default_price?) { should be_truthy }
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_core-3.0.10 spec/support/concerns/default_price_spec.rb
spree_core-3.0.9 spec/support/concerns/default_price_spec.rb
spree_core-3.0.8 spec/support/concerns/default_price_spec.rb
spree_core-3.0.7 spec/support/concerns/default_price_spec.rb
spree_core-3.0.6.1 spec/support/concerns/default_price_spec.rb
spree_core-3.0.6 spec/support/concerns/default_price_spec.rb