Sha256: caf1166599f6dfe7e8133e74d63ccc2b26aecf5bfd7bcf7546864330a3b62de0

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

require 'helper'

class TestPlatform < Test::Unit::TestCase
  def setup
    [Boom::Platform::Darwin, Boom::Platform::Linux,
      Boom::Platform::Windows].each do |klass|
      klass.any_instance.stubs('system')
    end
  end

  def test_darwin
    assert_equal Boom::Platform.platform.class,
      Boom::Platform::Darwin, RUBY_PLATFORM.include?('darwin')
  end

  def test_windows
    assert_equal Boom::Platform.platform.class,
      Boom::Platform::Windows if RUBY_PLATFORM =~ /mswin|mingw/
  end

  def test_linux
    assert_equal Boom::Platform.platform.class,
      Boom::Platform::Linux if RUBY_PLATFORM =~ /mswin|mingw/
  end

  def test_open_command_darwin
    assert_equal Boom::Platform::Darwin.new.open_command, 'open'
  end

  def test_open_command_windows
    assert_equal Boom::Platform::Windows.new.open_command, 'start'
  end

  def test_open_command_linux
    assert_equal Boom::Platform::Linux.new.open_command, 'xdg-open'
  end

  def test_copy_command_darwin
    assert_equal Boom::Platform::Darwin.new.copy_command, 'pbcopy'
  end

  def test_copy_command_windows
    assert_equal Boom::Platform::Windows.new.copy_command, 'clip'
  end

  def test_copy_command_linux
    assert_equal Boom::Platform::Linux.new.copy_command, 'xclip -selection clipboard'
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kaboom-0.3.3 test/test_platform.rb