Sha256: 38034638c3c34fd94e767bdcda336ed344c7e332946868b8b812940a7b1a08ae
Contents?: true
Size: 1.41 KB
Versions: 62
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true require_relative '../../../../lib/declare_schema/schema_change/table_add' RSpec.describe DeclareSchema::SchemaChange::TableAdd do before do load File.expand_path('../prepare_testapp.rb', __dir__) end let(:table_name) { 'networks' } let(:fields) { [[:string, :title, limit: 255, null: false ], [:boolean, :admin, null: false]] } let(:create_table_options) { { id: :primary_key } } let(:sql_options) { '' } subject { described_class.new(table_name, fields, create_table_options, sql_options: sql_options) } describe '#up/down' do describe '#up' do it 'responds with command' do expect(subject.up).to eq(<<~EOS) create_table :networks, id: :primary_key do |t| t.string :title, limit: 255, null: false t.boolean :admin, null: false end EOS end context 'with sql_options' do let(:sql_options) { 'CHARACTER SET utf8mb4' } it 'responds with command' do expect(subject.up).to eq(<<~EOS) create_table :networks, id: :primary_key, options: "CHARACTER SET utf8mb4" do |t| t.string :title, limit: 255, null: false t.boolean :admin, null: false end EOS end end end describe '#down' do it 'responds with command' do expect(subject.down).to eq("drop_table :#{table_name}\n") end end end end
Version data entries
62 entries across 62 versions & 1 rubygems