test/test_platform.rb in kaboom-0.3.2 vs test/test_platform.rb in kaboom-0.3.3
- old
+ new
@@ -1,52 +1,50 @@
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.darwin?, RUBY_PLATFORM.include?('darwin')
+ assert_equal Boom::Platform.platform.class,
+ Boom::Platform::Darwin, RUBY_PLATFORM.include?('darwin')
end
def test_windows
- assert_equal Boom::Platform.windows?, true if RUBY_PLATFORM =~ /mswin|mingw/
+ 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
- Boom::Platform.stubs(:darwin?).returns(true)
- assert_equal Boom::Platform.open_command, 'open'
+ assert_equal Boom::Platform::Darwin.new.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'
+ assert_equal Boom::Platform::Windows.new.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'
+ assert_equal Boom::Platform::Linux.new.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'
+ assert_equal Boom::Platform::Darwin.new.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'
+ assert_equal Boom::Platform::Windows.new.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'
+ assert_equal Boom::Platform::Linux.new.copy_command, 'xclip -selection clipboard'
end
-
+
end