Sha256: de7ae854a6b2ed594495bc9299c36bf5e67e8d8243c480eebee4840a41318247

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

require "test_helper"
require "roger/testing/mock_release"

module Roger
  # Test for Roger Rsync finalizer
  class RsyncTest < ::Test::Unit::TestCase
    include TestConstruct::Helpers

    def setup
      @release = Testing::MockRelease.new

      # Create a file to release in the build dir
      @release.project.construct.file "build/index.html"

      # Set fixed version
      @release.scm.version = "1.0.0"

      # A target dir
      @target_path = setup_construct(chdir: false)
    end

    # called after every single test
    def teardown
      teardown_construct(@target_path)
      @release.destroy
      @release = nil
    end

    def test_basic_functionality
      finalizer = Roger::Release::Finalizers::Rsync.new

      finalizer.call(
        @release,
        remote_path: @target_path.to_s,
        ask: false
      )

      assert File.exist?(@target_path + "index.html"), @release.target_path.inspect
    end

    def test_rsync_command_works
      finalizer = Roger::Release::Finalizers::Rsync.new

      assert_raise(RuntimeError) do
        finalizer.call(
          @release,
          rsync: "rsync-0123456789", # Let's hope nobody actually has this command
          remote_path: @target_path.to_s,
          ask: false
        )
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
roger-1.9.0 test/unit/release/finalizers/rsync_test.rb
roger-1.8.0 test/unit/release/finalizers/rsync_test.rb
roger-1.7.2 test/unit/release/finalizers/rsync_test.rb
roger-1.7.1 test/unit/release/finalizers/rsync_test.rb
roger-1.7.0 test/unit/release/finalizers/rsync_test.rb