Sha256: 1a9dfbe5ff0dd4bbbbca9b60c18c087d98054098c02aac013854b99e7fe54260

Contents?: true

Size: 1.36 KB

Versions: 15

Compression:

Stored size: 1.36 KB

Contents

require File.dirname(__FILE__) + '/spec_helper.rb'
require 'yaml'
require 'config/test_config.rb'

include RR

describe "PostgreSQLReplication", :shared => true do
  before(:each) do
  end

  it "create_replication_trigger should also work if language plpgsql does not yet exist" do
    session = nil
    begin
      session = Session.new
      session.left.begin_db_transaction
      unless session.left.select_all("select lanname from pg_language where lanname = 'plpgsql'").empty?
        session.left.execute "DROP LANGUAGE plpgsql"
      end
      params = {
        :trigger_name => 'rr_trigger_test',
        :table => 'trigger_test',
        :keys => ['first_id', 'second_id'],
        :log_table => 'rr_pending_changes',
        :key_sep => '|',
        :exclude_rr_activity => false,
      }
      session.left.create_replication_trigger params
      session.left.insert_record 'trigger_test', {
        'first_id' => 1,
        'second_id' => 2,
        'name' => 'bla'
      }

      row = session.left.select_one("select * from rr_pending_changes")
      row.delete 'id'
      row.delete 'change_time'
      row.should == {
        'change_table' => 'trigger_test',
        'change_key' => 'first_id|1|second_id|2',
        'change_new_key' => nil,
        'change_type' => 'I'
      }
      
    ensure
      session.left.rollback_db_transaction if session
    end
  end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
andyjeffries-rubyrep-1.2.1 spec/postgresql_replication_spec.rb
rubyrep-1.2.0 spec/postgresql_replication_spec.rb
rubyrep-1.1.2 spec/postgresql_replication_spec.rb
rubyrep-1.1.1 spec/postgresql_replication_spec.rb
rubyrep-1.1.0 spec/postgresql_replication_spec.rb
rubyrep-1.0.9 spec/postgresql_replication_spec.rb
rubyrep-1.0.8 spec/postgresql_replication_spec.rb
rubyrep-1.0.3 spec/postgresql_replication_spec.rb
rubyrep-1.0.4 spec/postgresql_replication_spec.rb
rubyrep-1.0.5 spec/postgresql_replication_spec.rb
rubyrep-1.0.6 spec/postgresql_replication_spec.rb
rubyrep-1.0.7 spec/postgresql_replication_spec.rb
rubyrep-1.0.2 spec/postgresql_replication_spec.rb
rubyrep-1.0.0 spec/postgresql_replication_spec.rb
rubyrep-1.0.1 spec/postgresql_replication_spec.rb