Sha256: 93db4451b5b33f1c3fc82e17ddbb8fe31176b8bbc633b1c663b75fb4361dfddf

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require 'helper'

class TestOak < Test::Unit::TestCase
  def setup
    @oak = Oak.new
    create_temp_file @oak
  end

  def teardown
    clear_temp_file @oak
  end

  def test_check_cfg
    FileUtils.cd @oak.destination_root do
      @oak.check_cfg
      assert_equal('config/config.yml', File.binread('.gitignore'))
      assert_equal('c1cae0f52a3ef8efa369a127c63bd6ede539a4089fd952b33199100a6769c8455ab4969f2eefaf1ebcbe0208bd57531204c77f41f715207f961e7e45f139f4e7', @oak.secret_token)
      ignored = File.binread(File.expand_path('~/.gitignore'))
      assert(ignored.include?('config/database.yml'))
    end
  end

  def test_create_config_on_deploy
    FileUtils.cd @oak.destination_root do
      @oak.check_cfg
      @oak.git_prepare
      @oak.create_config_on_deploy
      assert_equal('secret_token = ' + @oak.secret_token, File.binread('config/config.yml'))
    end
  end

  def test_setup
    @oak.setup @oak.destination_root
    FileUtils.chdir @oak.destination_root do
      File.open('.gitignore') do |f|
        lines = f.readlines
        assert_equal('config/config.yml', lines[0].chomp)
      end
      
      branch = `git symbolic-ref -q HEAD`.chomp
      assert_equal('refs/heads/master', branch)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oak-0.0.3 test/test_oak.rb
oak-0.0.2 test/test_oak.rb