Sha256: 5264904f44ec496bd038333d9beeaa26929f3d63506d81572984e41f315315d1

Contents?: true

Size: 1.69 KB

Versions: 3

Compression:

Stored size: 1.69 KB

Contents

require 'repo'

describe "git flow" do

  before :all do
    @work_dir = "tmp/git_flow"
    @repo_dir = "#{Dir.pwd}/tmp/repo.git"
    @deploy_dir = "#{@work_dir}/deploy"
    @drake = "#{Dir.pwd}/dev_exe/drake"
    FileUtils.rm_rf @work_dir
    FileUtils.mkdir_p @work_dir

    puts "=="* 40
    deploy_git
    puts "==" * 40
  end

  def system!(command)
    status = system command
    raise "error in '#{command}'" if not status
  end

  def deploy_config
    <<~CONFIG
      name "test"
      repo "#{@repo_dir}"
      strategy :git
      branch "master"

      dir_map ({
        "log" => "log",
        "tmp" => "tmp"
      })

      meta_conf do
        url = lambda { |name| "http://127.0.0.1:8000/config_repo/" + name }
        config "app.yml", url["app.yml"]
        config "custom.yml", url["custom.yml"]
        config "host.yml", url["host.yml"], deep_merge: false
      end
    CONFIG
  end

  def deploy_git
    FileUtils.mkdir @deploy_dir
    IO.write "#{@deploy_dir}/deploy.rb", deploy_config
    Dir.chdir @deploy_dir do
      system! "#{@drake} deploy"
    end
  end

  specify "app is deployed" do
    Dir.chdir @deploy_dir do
      expect(File).to exist("current")
      expect(File.directory?("current")).to be(true)
    end
  end

  specify "bundler installs the gems" do
    Dir.chdir @deploy_dir do
      expect(File).to exist("current/vendor/bundle/ruby")
    end
  end

  specify "reload works" do
    Dir.chdir @deploy_dir do
      system! "#{@drake} reload"
    end
  end

  specify "config renderer works" do
    Dir.chdir @deploy_dir do
      expect(File).to exist("current/test.txt")
      data = File.read "current/test.txt"
      expect(data).to eq("custom-host\napp-port\n")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dply-0.3.4 spec/integration/git_flow_spec.rb
dply-0.3.3 spec/integration/git_flow_spec.rb
dply-0.3.2 spec/integration/git_flow_spec.rb