package_manager 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,7 +6,7 @@ module PackageManager
6
6
  module VERSION #:nodoc:
7
7
  MAJOR = 0
8
8
  MINOR = 0
9
- TINY = 6
9
+ TINY = 7
10
10
 
11
11
  STRING = [ MAJOR, MINOR, TINY ].join('.')
12
12
  end
@@ -29,7 +29,7 @@ module PackageManager
29
29
  'port provides'
30
30
  end
31
31
 
32
- def contents_command
32
+ def list_contents_command
33
33
  'port contents'
34
34
  end
35
35
 
@@ -8,13 +8,11 @@ require File.join( ROOT_PATH, 'lib', 'package_manager' )
8
8
  describe 'script methods' do
9
9
 
10
10
  before( :all ) do
11
- PackageManager::Base.stub!( :operating_system ).and_return( 'linux' )
12
- PackageManager::Base.stub!( :program_installed? ).with( 'apt-get' ).and_return( true )
13
- @pkg = PackageManager::Base.load
11
+ @pkg = PackageManager::Base.load( 'apt' )
14
12
  end
15
13
 
16
14
  it "should run commands through a subprocess" do
17
- @pkg.should_receive( '`'.intern ).and_return( "foo\n" )
15
+ IO.should_receive( :popen ).and_return( "foo\n" )
18
16
  @pkg.find_available( 'pkg' )
19
17
  end
20
18
 
@@ -33,31 +31,27 @@ describe 'script methods' do
33
31
  @pkg.list_contents( 'pkg' ).should be_a( Array )
34
32
  end
35
33
 
36
- it "#install should return true or false" do
37
- `ls`
38
- @pkg.stub!( :run_command )
39
- @pkg.install( 'pkg' ).should be_true
34
+ it "#install should replace the current process via exec" do
35
+ @pkg.should_receive( :exec )
36
+ @pkg.install( 'pkg' )
40
37
  end
41
38
 
42
- it "#install_file should return true or false" do
43
- `ls` # Force $?.exitstatus to be 0
44
- @pkg.stub!( :run_command )
39
+ it "#install_file should replace the current process via exec" do
40
+ @pkg.should_receive( :exec )
45
41
  File.stub!( :exist? ).and_return( true )
46
- @pkg.install_file( 'my_pkg' ).should be_true
42
+ @pkg.install_file( 'my_pkg' )
47
43
  end
48
44
 
49
45
  it "#install_file should throw an error if the file does not exist" do
50
- @pkg.stub!( :run_command )
51
46
  File.stub!( :exist? ).and_return( false )
52
47
  lambda do
53
48
  @pkg.install_file( 'my_pkg' )
54
49
  end.should raise_error( StandardError, /does not exist/ )
55
50
  end
56
51
 
57
- it "#uninstall should return true or false" do
58
- `ls`
59
- @pkg.stub!( :run_command )
60
- @pkg.uninstall( 'pkg' ).should be_true
52
+ it "#uninstall should replace the current process via exec" do
53
+ @pkg.should_receive( :exec )
54
+ @pkg.uninstall( 'pkg' )
61
55
  end
62
56
 
63
57
  it "#provides should return a String" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: package_manager
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joe Yates
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-23 00:00:00 +01:00
18
+ date: 2010-10-01 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency