Sha256: b17b83d55f8d0d0a76b1faa6c1c4fb83bb5ee4cb358961e2226a462dc01945ef

Contents?: true

Size: 1.69 KB

Versions: 1

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

describe CommandLine do

  before(:all) do
    @dbutil = DbUtility.new
  end


  it "build using config file" do

    single_manifest=File.expand_path('spec/pg_migrate/input_manifests/single_manifest')
    single_manifest=File.join(single_manifest, '.')

    input_dir = nil
    target = Files.create :path => "target", :timestamp => false do
      input_dir = dir "input_single_manifest", :src => single_manifest do

      end
    end

    output_dir = File.join("target", 'output_single_manifest')

    FileUtils.rm_rf(output_dir)

    # make a properties file on the fly, with the out parameter specified
    props = Properties.new
    props['build.out'] = output_dir
    props['build.force'] = "true"
    props['build.test'] = "false"
    #props['up.connopts'] = "dbname:pg_migrate_test host:localhost port:5432 user:postgres password:postgres"

    # and put that properties file in the input dir
    File.open(File.join(input_dir, PG_CONFIG), 'w') { |f| f.write(props) }

    # invoke pg_migrate build, with the hopes that the output dir is honored
    result = `bundle exec pg_migrate build -s #{input_dir}`

    puts "pg_migrate build output: #{result}"

    $?.exitstatus.should == 0

    FileTest::exist?(output_dir).should == true
    FileTest::exist?(File.join(output_dir, MANIFEST_FILENAME)).should == true
    FileTest::exist?(File.join(output_dir, PG_CONFIG)).should == true
    FileTest::exist?(File.join(output_dir, UP_DIRNAME)).should == true
    FileTest::exist?(File.join(output_dir, UP_DIRNAME, BOOTSTRAP_FILENAME)).should == true
    FileTest::exist?(File.join(output_dir, UP_DIRNAME, "single1.sql")).should == true


  end


end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pg_migrate-0.1.11 spec/pg_migrate/command_line_spec.rb