Sha256: 90ce52873df9ec360538ec4a7674aeeda836053a329cad883e9bc9e0ecef2fc6

Contents?: true

Size: 759 Bytes

Versions: 1

Compression:

Stored size: 759 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
    after { initialize_schema }
    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

1 entries across 1 versions & 1 rubygems

Version Path
active_record-acts_as-1.0.8 spec/migrations_spec.rb