Sha256: b8671ac4ed56338c9c9236e3f5295c43eff2bf8fbb089509c9d94580c093eaca

Contents?: true

Size: 916 Bytes

Versions: 15

Compression:

Stored size: 916 Bytes

Contents

# frozen_string_literal: true

require_relative '../../../../lib/declare_schema/schema_change/column_add'

RSpec.describe DeclareSchema::SchemaChange::ColumnAdd do
  before do
    load File.expand_path('../prepare_testapp.rb', __dir__)
  end

  let(:table_name) { 'networks' }
  let(:column_name) { 'title' }
  let(:column_type) { :integer }
  let(:column_options) { { limit: 8 } }
  let(:column_options_string) { "limit: 8" }
  subject { described_class.new(table_name, column_name, column_type, column_options) }

  describe '#up/down' do
    describe '#up' do
      it 'responds with command' do
        expect(subject.up).to eq("add_column :#{table_name}, :#{column_name}, :#{column_type}, #{column_options_string}\n")
      end
    end

    describe '#down' do
      it 'responds with command' do
        expect(subject.down).to eq("remove_column :#{table_name}, :#{column_name}\n")
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
declare_schema-0.14.2 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.14.1 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.14.0 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.13.2 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.13.1 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.13.0 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.13.0.pre.2 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.13.0.pre.1 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.12.1 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.12.0 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.12.0.pre.2 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.12.0.pre.1 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.11.1 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.11.0 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-0.10.1 spec/lib/declare_schema/schema_change/column_add_spec.rb