Sha256: 2f77366e7842d95e31204eea2248726258afd8066e58288d2de076c13ad0363e

Contents?: true

Size: 918 Bytes

Versions: 47

Compression:

Stored size: 918 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

47 entries across 47 versions & 1 rubygems

Version Path
declare_schema-1.4.0 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.4.0.colin.11 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.3.6 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.3.6.colin.1 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.3.5 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.3.5.colin.1 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.4.0.colin.9 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.3.4 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.3.4.colin.1 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.4.0.colin.8 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.3.3 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.3.3.colin.1 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.4.0.colin.7 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.4.0.colin.6 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.4.0.colin.5 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.4.0.colin.4 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.4.0.colin.3 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.4.0.colin.2 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.4.0.colin.1 spec/lib/declare_schema/schema_change/column_add_spec.rb
declare_schema-1.3.2 spec/lib/declare_schema/schema_change/column_add_spec.rb