Sha256: f75407fa627a48e14b2a47c99e2ba7d3de66fea34cc18468800f64617259b51c

Contents?: true

Size: 727 Bytes

Versions: 10

Compression:

Stored size: 727 Bytes

Contents

require 'database_helper'
require 'active_record/acts_as'


class Product < ActiveRecord::Base
end


RSpec.describe ".actable" do
  context "in .create_table block" do
    context "with :as options" do
      it "creates plymorphic reference columns with given name" do
        initialize_database { create_table(:products) { |t| t.actable(as: :produceable) } }
        expect(Product.column_names).to include('produceable_id', 'produceable_type')
      end
    end

    context "with no args" do
      it "creates plymorphic reference columns" do
        initialize_database { create_table(:products) { |t| t.actable } }
        expect(Product.column_names).to include('actable_id', 'actable_type')
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
active_record-acts_as-1.0.7 spec/migrations_spec.rb
active_record-acts_as-1.0.6 spec/migrations_spec.rb
active_record-acts_as-1.0.5 spec/migrations_spec.rb
active_record-acts_as-1.0.4 spec/migrations_spec.rb
active_record-acts_as-1.0.3 spec/migrations_spec.rb
active_record-acts_as-1.0.2 spec/migrations_spec.rb
active_record-acts_as-1.0.1 spec/migrations_spec.rb
active_record-acts_as-1.0.0 spec/migrations_spec.rb
active_record-acts_as-1.0.0.rc spec/migrations_spec.rb
active_record-acts_as-1.0.0.pre spec/migrations_spec.rb