Sha256: a13df1a6818036fcd4ac7ab5e41c0b29e832bab3e376f3fe88bdbdbac69e190f

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe PgComment::Migration::CommandRecorder do
  class CommandRecorderStub
    include ::PgComment::Migration::CommandRecorder
  end

  let(:command_recorder_stub){ CommandRecorderStub.new }

  [ :set_table_comment,
    :remove_table_comment,
    :set_column_comment,
    :set_column_comments,
    :remove_column_comment,
    :remove_column_comments,
    :set_index_comment,
    :remove_index_comment ].each{ |method_name|

    it ".#{method_name}" do
      command_recorder_stub.should_receive(:record).with(method_name, [])
      command_recorder_stub.send(method_name)
    end
  }

  it '.invert_set_table_comment' do
    command_recorder_stub.invert_set_table_comment([:foo, :bar]).should == [:remove_table_comment, [:foo]]
  end

  it '.invert_set_column_comment' do
    command_recorder_stub.invert_set_column_comment([:foo, :bar, :baz]).should == [:remove_column_comment, [:foo, :bar]]
  end

  it '.invert_set_column_comments' do
    command_recorder_stub.invert_set_column_comments([:foo, {:bar => :baz}]).should == [:remove_column_comments, [:foo, :bar]]
  end

  it '.invert_set_index_comment' do
    command_recorder_stub.invert_set_index_comment([:foo, :bar]).should == [:remove_index_comment, [:foo]]
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pg_comment-0.3.0 spec/lib/pg_comment/migration/command_recorder_spec.rb
pg_comment-0.2.1 spec/lib/pg_comment/migration/command_recorder_spec.rb
pg_comment-0.2.0 spec/lib/pg_comment/migration/command_recorder_spec.rb