Sha256: 97a1c449aeaf46d9a30da211800a796172d11f6da193058ce1b4c6349bd0fa92

Contents?: true

Size: 1.88 KB

Versions: 1

Compression:

Stored size: 1.88 KB

Contents

# encoding: utf-8

class Nanoc::CLI::Commands::DeployTest < MiniTest::Unit::TestCase

  include Nanoc::TestHelpers

  def test_deploy
    if_have 'systemu' do
      with_site do |site|
        File.open('config.yaml', 'w') do |io|
          io.write "deploy:\n"
          io.write "  public:\n"
          io.write "    kind: rsync\n"
          io.write "    dst: mydestination"
        end

        FileUtils.mkdir_p('output')
        File.open('output/blah.html', 'w') { |io| io.write 'moo' }

        Nanoc::CLI.run %w( deploy -t public )

        assert File.directory?('mydestination')
        assert File.file?('mydestination/blah.html')
      end
    end
  end

  def test_deploy_with_dry_run
    if_have 'systemu' do
      with_site do |site|
        File.open('config.yaml', 'w') do |io|
          io.write "deploy:\n"
          io.write "  public:\n"
          io.write "    kind: rsync\n"
          io.write "    dst: mydestination"
        end

        FileUtils.mkdir_p('output')
        File.open('output/blah.html', 'w') { |io| io.write 'moo' }

        Nanoc::CLI.run %w( deploy -t public -n )

        refute File.directory?('mydestination')
        refute File.file?('mydestination/blah.html')
      end
    end
  end

  def test_deploy_with_list
    if_have 'systemu' do
      with_site do |site|
        File.open('config.yaml', 'w') do |io|
          io.write "deploy:\n"
          io.write "  public:\n"
          io.write "    kind: rsync\n"
          io.write "    dst: mydestination"
        end

        FileUtils.mkdir_p('output')
        File.open('output/blah.html', 'w') { |io| io.write 'moo' }

        ios = capturing_stdio do
          Nanoc::CLI.run %w( deploy -l )
        end

        assert ios[:stdout].include?('Available deployment configurations:')

        refute File.directory?('mydestination')
        refute File.file?('mydestination/blah.html')
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nanoc-3.3.0 test/cli/commands/test_deploy.rb