Sha256: 380a293651d0e6ce8860ecc3e921b6605cd3c290066f8b98e4d4f285933cb68d

Contents?: true

Size: 1.4 KB

Versions: 24

Compression:

Stored size: 1.4 KB

Contents

require File.join(File.dirname(__FILE__), '/../test_helper')

class SchemaStatementsTest < ActiveSupport::TestCase

  def teardown
    %w(fake_contents fake_content_versions).each do |table|
      ActiveRecord::Base.connection.drop_table(table) rescue nil
    end
  end

  test "create_content_table should make two tables" do
    conn = ActiveRecord::Base.connection
    conn.create_content_table :fake_contents do |t|
      t.string :name
    end

    expected_columns = %w(archived created_at created_by_id deleted id lock_version name published updated_at updated_by_id version)
    expected_columns_v = %w(archived created_at created_by_id deleted fake_content_id id name published updated_at updated_by_id version version_comment)
    assert_equal expected_columns, conn.columns(:fake_contents).map { |c| c.name }.sort
    assert_equal expected_columns_v, conn.columns(:fake_content_versions).map { |c| c.name }.sort
  end

  test "add_content_column should add columns to both primary and versions table" do
    connection.create_content_table :fake_contents do |t| end

    connection.add_content_column :fake_contents, :foo, :string

    found_c = connection.columns(:fake_contents).map { |c| c.name }
    assert found_c.include?("foo")

    found_c = connection.columns(:fake_content_versions).map { |c| c.name }
    assert found_c.include?("foo")
  end


  def connection
    ActiveRecord::Base.connection
  end
end


Version data entries

24 entries across 24 versions & 7 rubygems

Version Path
buzzware-browsercms-3.0.2 test/unit/schema_statements_test.rb
browsercms-3.1.5 test/unit/schema_statements_test.rb
browsercms-3.1.4 test/unit/schema_statements_test.rb
browsercms-3.1.3 test/unit/schema_statements_test.rb
bf4-browsercms-3.1.0 test/unit/schema_statements_test.rb
drujensen-browsercms-3.2.0 test/unit/schema_statements_test.rb
browsercmsi-3.1.2 test/unit/schema_statements_test.rb
browsercms-3.1.2 test/unit/schema_statements_test.rb
browsercms-3.1.1 test/unit/schema_statements_test.rb
browsercmsi-3.1.1 test/unit/schema_statements_test.rb
browsercmsi-3.1.0 test/unit/schema_statements_test.rb
browsercms-3.1.0 test/unit/schema_statements_test.rb
we5-browsercms-3.1.0 test/unit/schema_statements_test.rb
browsercms-3.0.6 test/unit/schema_statements_test.rb
browsercms-3.0.5 test/unit/schema_statements_test.rb
we5-browsercms-3.0.5.1 test/unit/schema_statements_test.rb
we5-browsercms-3.0.5 test/unit/schema_statements_test.rb
browsercms_s3-3.0.5 test/unit/schema_statements_test.rb
browsercms-3.0.4 test/unit/schema_statements_test.rb
browsercms-3.0.3 test/unit/schema_statements_test.rb