Sha256: fdafd10bee05be9c71f31c420d6a837ea316f9e0708475a2ff1d203a06cb3418

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

require 'test_helper'

class UnixSystemTest < Test::Unit::TestCase
  include SproutTestCase

  context "new unix system" do

    setup do
      @user = Sprout::System::UnixSystem.new
      @user.stubs(:home).returns '/home/someone'
    end

    should "escape spaces in paths" do
      assert_equal 'a\ b', @user.clean_path('a b')
    end

    should "snake case application name" do
      assert_equal '.foo_bar', @user.format_application_name('Foo Bar')
    end

    should "have home" do
      assert_equal '/home/someone', @user.home
    end

    should "have library" do
      assert_equal '/home/someone', @user.library
    end

    should "format application home" do
      assert_equal '/home/someone/.sprouts', @user.application_home('Sprouts')
    end

    context "when fed an application with windows line endings" do

      setup do
        @source = File.join fixtures, 'executable', 'windows_line_endings'
        @target = File.join fixtures, 'executable', 'windows_line_endings.tmp'
        FileUtils.cp @source, @target
      end

      teardown do
        remove_file @target
      end

      should "fix windows line endings" do
        @user.expects :repair_executable
        @user.attempt_to_repair_executable @target
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sprout-1.0.35.pre test/unit/unix_system_test.rb
sprout-1.0.32.pre test/unit/unix_system_test.rb
sprout-1.0.31.pre test/unit/unix_system_test.rb
sprout-1.0.29.pre test/unit/unix_system_test.rb