ruby-virtualenv 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,145 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'including', Sandbox::Output do
4
+ class Tester
5
+ include Sandbox::Output
6
+ end
7
+
8
+ before( :each ) do
9
+ Sandbox.instance_eval { instance_variables.each { |v| remove_instance_variable v } }
10
+ @tester = Tester.new
11
+ end
12
+
13
+ it "should have tell method" do
14
+ @tester.should respond_to( :tell )
15
+ end
16
+
17
+ it "should have tell_when_verbose method" do
18
+ @tester.should respond_to( :tell_when_verbose )
19
+ end
20
+
21
+ it "should have tell_when_really_verbose method" do
22
+ @tester.should respond_to( :tell_when_really_verbose )
23
+ end
24
+
25
+ it "should have tell_unless_quiet method" do
26
+ @tester.should respond_to( :tell_unless_quiet )
27
+ end
28
+
29
+ it "should have tell_unless_really_quiet method" do
30
+ @tester.should respond_to( :tell_unless_really_quiet )
31
+ end
32
+
33
+ describe "calling tell" do
34
+ it "should require message" do
35
+ lambda { @tester.tell }.should raise_error( ArgumentError )
36
+ end
37
+
38
+ it "should call puts when normal" do
39
+ @tester.expects( :puts )
40
+ @tester.tell( "message" )
41
+ end
42
+
43
+ it "should not call puts when below normal verbosity" do
44
+ Sandbox.decrease_verbosity
45
+ @tester.expects( :puts ).never
46
+ @tester.tell( "message" )
47
+ end
48
+
49
+ it "should call puts when above normal verbosity" do
50
+ Sandbox.increase_verbosity
51
+ @tester.expects( :puts )
52
+ @tester.tell( "message" )
53
+ end
54
+ end
55
+
56
+ describe "calling tell_when_verbose" do
57
+ it "should require message" do
58
+ lambda { @tester.tell_when_verbose }.should raise_error( ArgumentError )
59
+ end
60
+
61
+ it "should not call puts when normal verbosity" do
62
+ @tester.expects( :puts ).never
63
+ @tester.tell_when_verbose( "message" )
64
+ end
65
+
66
+ it "should call puts when above normal verbosity" do
67
+ Sandbox.increase_verbosity
68
+ @tester.expects( :puts )
69
+ @tester.tell_when_verbose( "message" )
70
+ end
71
+ end
72
+
73
+ describe "calling tell_when_really_verbose" do
74
+ it "should require message" do
75
+ lambda { @tester.tell_when_really_verbose }.should raise_error( ArgumentError )
76
+ end
77
+
78
+ it "should not call puts when normal verbosity" do
79
+ @tester.expects( :puts ).never
80
+ @tester.tell_when_really_verbose( "message" )
81
+ end
82
+
83
+ it "should call puts when above normal verbosity" do
84
+ Sandbox.increase_verbosity
85
+ @tester.expects( :puts ).never
86
+ @tester.tell_when_really_verbose( "message" )
87
+ end
88
+
89
+ it "should call puts when really above normal verbosity" do
90
+ Sandbox.increase_verbosity
91
+ Sandbox.increase_verbosity
92
+ @tester.expects( :puts )
93
+ @tester.tell_when_really_verbose( "message" )
94
+ end
95
+ end
96
+
97
+ describe "calling tell_unless_quiet" do
98
+ it "should require message" do
99
+ lambda { @tester.tell_unless_quiet }.should raise_error( ArgumentError )
100
+ end
101
+
102
+ it "should call puts when normal" do
103
+ @tester.expects( :puts )
104
+ @tester.tell_unless_quiet( "message" )
105
+ end
106
+
107
+ it "should not call puts when below normal verbosity" do
108
+ Sandbox.decrease_verbosity
109
+ @tester.expects( :puts ).never
110
+ @tester.tell_unless_quiet( "message" )
111
+ end
112
+
113
+ it "should call puts when above normal verbosity" do
114
+ Sandbox.increase_verbosity
115
+ @tester.expects( :puts )
116
+ @tester.tell_unless_quiet( "message" )
117
+ end
118
+ end
119
+
120
+ describe "calling tell_unless_really_quiet" do
121
+ it "should require message" do
122
+ lambda { @tester.tell_unless_really_quiet }.should raise_error( ArgumentError )
123
+ end
124
+
125
+ it "should call puts when normal" do
126
+ @tester.expects( :puts )
127
+ @tester.tell_unless_really_quiet( "message" )
128
+ end
129
+
130
+ it "should call puts when below normal verbosity" do
131
+ Sandbox.decrease_verbosity
132
+ @tester.expects( :puts )
133
+ @tester.tell_unless_really_quiet( "message" )
134
+ end
135
+
136
+ it "should not call puts when really below normal verbosity" do
137
+ Sandbox.decrease_verbosity
138
+ Sandbox.decrease_verbosity
139
+ @tester.expects( :puts ).never
140
+ @tester.tell_unless_really_quiet( "message" )
141
+ end
142
+ end
143
+
144
+ end
145
+
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Sandbox do
4
+
5
+ before( :each ) do
6
+ Sandbox.instance_eval { instance_variables.each { |v| remove_instance_variable(v) } }
7
+ end
8
+
9
+ it "should have verbosity level" do
10
+ Sandbox.verbosity.should == 0
11
+ end
12
+
13
+ it "should increase verbosity level" do
14
+ Sandbox.verbosity.should == 0
15
+ Sandbox.increase_verbosity
16
+ Sandbox.verbosity.should == 1
17
+ end
18
+
19
+ it "should decrease verbosity level" do
20
+ Sandbox.verbosity.should == 0
21
+ Sandbox.decrease_verbosity
22
+ Sandbox.verbosity.should == -1
23
+ end
24
+
25
+ end
@@ -0,0 +1,46 @@
1
+ $:.unshift( File.dirname( __FILE__ ) + '/../lib' )
2
+
3
+ require 'rubygems'
4
+ require 'mocha'
5
+ require 'rspec'
6
+ require 'stringio'
7
+ require 'ostruct'
8
+ require 'tempfile'
9
+
10
+ require 'sandbox'
11
+
12
+ RSpec.configure do |config|
13
+ config.mock_with :mocha
14
+
15
+ def capture
16
+ results = OpenStruct.new
17
+
18
+ begin
19
+ $stdout = StringIO.new
20
+ $stderr = StringIO.new
21
+ yield
22
+ results.stdout = $stdout.string
23
+ results.stderr = $stderr.string
24
+ ensure
25
+ $stdout = STDOUT
26
+ $stderr = STDERR
27
+ end
28
+
29
+ results
30
+ end
31
+
32
+ alias silence capture
33
+ end
34
+
35
+ # Thanks to Jay Fields for http://blog.jayfields.com/2007/11/ruby-testing-private-methods.html
36
+ class Class
37
+ def publicize_methods
38
+ saved_private_instance_methods = self.private_instance_methods
39
+ begin
40
+ self.class_eval { public *saved_private_instance_methods }
41
+ yield
42
+ ensure
43
+ self.class_eval { private *saved_private_instance_methods }
44
+ end
45
+ end
46
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-virtualenv
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jacob Radford
9
+ - Francesc Esplugas
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2011-10-02 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ requirement: &70170803900960 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 2.6.0
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: *70170803900960
26
+ - !ruby/object:Gem::Dependency
27
+ name: mocha
28
+ requirement: &70170803899420 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.10.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *70170803899420
37
+ description: Create virtual ruby/rubygems environments.
38
+ email:
39
+ - nkryptic@gmail.com
40
+ - francesc.esplugas@gmail.com
41
+ executables:
42
+ - ruby-virtualenv
43
+ extensions: []
44
+ extra_rdoc_files: []
45
+ files:
46
+ - .autotest
47
+ - .gitignore
48
+ - CHANGELOG
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - README.md
52
+ - Rakefile
53
+ - TODO
54
+ - bin/ruby-virtualenv
55
+ - features/development.feature
56
+ - features/steps/common.rb
57
+ - features/steps/env.rb
58
+ - lib/sandbox.rb
59
+ - lib/sandbox/cli.rb
60
+ - lib/sandbox/errors.rb
61
+ - lib/sandbox/installer.rb
62
+ - lib/sandbox/output.rb
63
+ - lib/sandbox/templates/activate.erb
64
+ - lib/sandbox/templates/gemrc.erb
65
+ - lib/sandbox/version.rb
66
+ - ruby-virtualenv.gemspec
67
+ - spec/sandbox/cli_spec.rb
68
+ - spec/sandbox/errors_spec.rb
69
+ - spec/sandbox/installer_spec.rb
70
+ - spec/sandbox/output_spec.rb
71
+ - spec/sandbox_spec.rb
72
+ - spec/spec_helper.rb
73
+ homepage: http://github.com/fesplugas/ruby-virtualenv
74
+ licenses: []
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ none: false
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 1.8.10
94
+ signing_key:
95
+ specification_version: 3
96
+ summary: Create virtual ruby/rubygems environments.
97
+ test_files:
98
+ - features/development.feature
99
+ - features/steps/common.rb
100
+ - features/steps/env.rb
101
+ - spec/sandbox/cli_spec.rb
102
+ - spec/sandbox/errors_spec.rb
103
+ - spec/sandbox/installer_spec.rb
104
+ - spec/sandbox/output_spec.rb
105
+ - spec/sandbox_spec.rb
106
+ - spec/spec_helper.rb