Skip to content

Commit

Permalink
got it. sneaky system open commands, hiding in the Platform class
Browse files Browse the repository at this point in the history
  • Loading branch information
markburns committed Mar 18, 2012
1 parent 0a9ebdd commit 092c695
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
17 changes: 9 additions & 8 deletions test/test_command.rb
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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])
Expand Down
9 changes: 6 additions & 3 deletions test/test_platform.rb
Expand Up @@ -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
Expand Down

0 comments on commit 092c695

Please sign in to comment.