Permalink
Browse files

got it. sneaky system open commands, hiding in the Platform class

  • Loading branch information...
1 parent 0a9ebdd commit 092c695a37b2a6c5d04d5fd77cc5340fcd8ff300 @markburns committed Mar 18, 2012
Showing with 15 additions and 11 deletions.
  1. +9 −8 test/test_command.rb
  2. +6 −3 test/test_platform.rb
View
@@ -6,6 +6,11 @@
class TestCommand < Test::Unit::TestCase
def setup
+ [Boom::Platform::Darwin, Boom::Platform::Linux,
+ Boom::Platform::Windows].each do |klass|
+ klass.any_instance.stubs('system')
+ end
+ IO.stubs(:popen)
boom_json :urls
end
@@ -47,9 +52,9 @@ def test_list_detail
end
def test_list_all
- #cmd = command('all')
- #assert_match /urls/, cmd
- #assert_match /github/, cmd
+ cmd = command('all')
+ assert_match /urls/, cmd
+ assert_match /github/, cmd
end
def test_list_creation
@@ -81,17 +86,14 @@ def test_item_access_scoped_by_list
end
def test_item_open_item
- Boom::Platform::Darwin.any_instance.stubs(:system).returns('')
assert_match /opened https:\/\/github\.com for you/, command('open github')
end
def test_item_open_specific_item
- Boom::Platform::Darwin.any_instance.stubs(:system).returns('')
assert_match /opened https:\/\/github\.com for you/, command('open urls github')
end
def test_item_open_lists
- Boom::Platform::Darwin.any_instance.stubs(:system).returns('')
assert_match /opened all of urls for you/, command('open urls')
end
@@ -120,7 +122,7 @@ def test_item_deletion
end
def test_edit
- Boom::Platform::Darwin.any_instance.stubs(:system).returns('')
+ Boom::Platform.stubs(:system).returns('')
assert_match 'Make your edits', command('edit')
end
@@ -181,7 +183,6 @@ def test_version_switch
def test_version_long
assert_match /#{Boom::VERSION}/, command('--version')
end
-
def test_stdin_pipes
stub = Object.new
stub.stubs(:stat).returns([1,2])
View
@@ -9,15 +9,18 @@ def setup
end
def test_darwin
- assert_equal Boom::Platform.platform.class, 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.platform.class, Boom::Platform::Windows 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/
+ assert_equal Boom::Platform.platform.class,
+ Boom::Platform::Linux if RUBY_PLATFORM =~ /mswin|mingw/
end
def test_open_command_darwin

0 comments on commit 092c695

Please sign in to comment.