Sha256: 4d08ab4ab7cde5739c1ccf4165a30fe7b322c23b84c0eb89ca950854f5af252e

Contents?: true

Size: 782 Bytes

Versions: 11

Compression:

Stored size: 782 Bytes

Contents

require 'spec_helper'

# This is a bit of a insane spec I have to admit
# Chosed the spree_payment_methods table because it has a `name` column
# already. Stubs wouldn't work here (the delegation runs before this spec is
# loaded) and adding a column here might make the test even crazy so here we go
module Spree
  class DelegateBelongsToStubModel < Spree::Base
    self.table_name = "spree_payment_methods"
    belongs_to :product
    Spree::Deprecation.silence do
      delegate_belongs_to :product, :name
    end
  end

  describe DelegateBelongsToStubModel do
    context "model has column attr delegated to associated object" do
      it "doesnt touch the associated object" do
        expect(subject).not_to receive(:product)
        subject.name
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
solidus_core-2.0.3 spec/lib/spree/core/delegate_belongs_to_spec.rb
solidus_core-1.4.2 spec/lib/spree/core/delegate_belongs_to_spec.rb
solidus_core-2.0.2 spec/lib/spree/core/delegate_belongs_to_spec.rb
solidus_core-1.4.1 spec/lib/spree/core/delegate_belongs_to_spec.rb
solidus_core-2.0.1 spec/lib/spree/core/delegate_belongs_to_spec.rb
solidus_core-2.0.0 spec/lib/spree/core/delegate_belongs_to_spec.rb
solidus_core-1.4.0 spec/lib/spree/core/delegate_belongs_to_spec.rb
solidus_core-2.0.0.rc1 spec/lib/spree/core/delegate_belongs_to_spec.rb
solidus_core-1.4.0.rc1 spec/lib/spree/core/delegate_belongs_to_spec.rb
solidus_core-2.0.0.beta1 spec/lib/spree/core/delegate_belongs_to_spec.rb
solidus_core-1.4.0.beta1 spec/lib/spree/core/delegate_belongs_to_spec.rb