Sha256: 8d10a067222e8616e6de0e21d6f388976d5f244552803ad3f019ed08cc4374b4

Contents?: true

Size: 1.39 KB

Versions: 3

Compression:

Stored size: 1.39 KB

Contents

require 'helper'

class TestPlatform < Test::Unit::TestCase

  def setup

  end

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

  def test_windows
    assert_equal Boom::Platform.windows?, true if RUBY_PLATFORM =~ /mswin|mingw/
  end
  
  def test_open_command_darwin
    Boom::Platform.stubs(:darwin?).returns(true)
    assert_equal Boom::Platform.open_command, 'open'
  end
  
  def test_open_command_windows
    Boom::Platform.stubs(:darwin?).returns(false)
    Boom::Platform.stubs(:windows?).returns(true)
    assert_equal Boom::Platform.open_command, 'start'
  end
  
  def test_open_command_linux
    Boom::Platform.stubs(:darwin?).returns(false)
    Boom::Platform.stubs(:windows?).returns(false)
    assert_equal Boom::Platform.open_command, 'xdg-open'
  end

  def test_copy_command_darwin
    Boom::Platform.stubs(:darwin?).returns(true)
    Boom::Platform.stubs(:windows?).returns(false)
    assert_equal Boom::Platform.copy_command, 'pbcopy'
  end

  def test_copy_command_windows
    Boom::Platform.stubs(:darwin?).returns(false)
    Boom::Platform.stubs(:windows?).returns(true)
    assert_equal Boom::Platform.copy_command, 'clip'
  end

  def test_copy_command_linux
    Boom::Platform.stubs(:darwin?).returns(false)
    Boom::Platform.stubs(:windows?).returns(false)
    assert_equal Boom::Platform.copy_command, 'xclip -selection clipboard'
  end
  
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
boom-0.2.4 test/test_platform.rb
kaboom-0.3.2 test/test_platform.rb
kaboom-0.3.1 test/test_platform.rb