beaker 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +2 -0
  4. data/.simplecov +14 -0
  5. data/DOCUMENTING.md +167 -0
  6. data/Gemfile +3 -0
  7. data/LICENSE +17 -0
  8. data/README.md +332 -0
  9. data/Rakefile +121 -0
  10. data/beaker.gemspec +42 -0
  11. data/beaker.rb +10 -0
  12. data/bin/beaker +9 -0
  13. data/lib/beaker.rb +36 -0
  14. data/lib/beaker/answers.rb +29 -0
  15. data/lib/beaker/answers/version28.rb +104 -0
  16. data/lib/beaker/answers/version30.rb +194 -0
  17. data/lib/beaker/cli.rb +113 -0
  18. data/lib/beaker/command.rb +241 -0
  19. data/lib/beaker/command_factory.rb +21 -0
  20. data/lib/beaker/dsl.rb +85 -0
  21. data/lib/beaker/dsl/assertions.rb +87 -0
  22. data/lib/beaker/dsl/helpers.rb +625 -0
  23. data/lib/beaker/dsl/install_utils.rb +299 -0
  24. data/lib/beaker/dsl/outcomes.rb +99 -0
  25. data/lib/beaker/dsl/roles.rb +97 -0
  26. data/lib/beaker/dsl/structure.rb +63 -0
  27. data/lib/beaker/dsl/wrappers.rb +100 -0
  28. data/lib/beaker/host.rb +193 -0
  29. data/lib/beaker/host/aix.rb +15 -0
  30. data/lib/beaker/host/aix/file.rb +16 -0
  31. data/lib/beaker/host/aix/group.rb +35 -0
  32. data/lib/beaker/host/aix/user.rb +32 -0
  33. data/lib/beaker/host/unix.rb +54 -0
  34. data/lib/beaker/host/unix/exec.rb +15 -0
  35. data/lib/beaker/host/unix/file.rb +16 -0
  36. data/lib/beaker/host/unix/group.rb +40 -0
  37. data/lib/beaker/host/unix/pkg.rb +22 -0
  38. data/lib/beaker/host/unix/user.rb +32 -0
  39. data/lib/beaker/host/windows.rb +44 -0
  40. data/lib/beaker/host/windows/exec.rb +18 -0
  41. data/lib/beaker/host/windows/file.rb +15 -0
  42. data/lib/beaker/host/windows/group.rb +36 -0
  43. data/lib/beaker/host/windows/pkg.rb +26 -0
  44. data/lib/beaker/host/windows/user.rb +32 -0
  45. data/lib/beaker/hypervisor.rb +37 -0
  46. data/lib/beaker/hypervisor/aixer.rb +52 -0
  47. data/lib/beaker/hypervisor/blimper.rb +123 -0
  48. data/lib/beaker/hypervisor/fusion.rb +56 -0
  49. data/lib/beaker/hypervisor/solaris.rb +65 -0
  50. data/lib/beaker/hypervisor/vagrant.rb +118 -0
  51. data/lib/beaker/hypervisor/vcloud.rb +175 -0
  52. data/lib/beaker/hypervisor/vsphere.rb +80 -0
  53. data/lib/beaker/hypervisor/vsphere_helper.rb +200 -0
  54. data/lib/beaker/logger.rb +167 -0
  55. data/lib/beaker/network_manager.rb +73 -0
  56. data/lib/beaker/options_parsing.rb +323 -0
  57. data/lib/beaker/result.rb +55 -0
  58. data/lib/beaker/shared.rb +15 -0
  59. data/lib/beaker/shared/error_handler.rb +17 -0
  60. data/lib/beaker/shared/host_handler.rb +46 -0
  61. data/lib/beaker/shared/repetition.rb +28 -0
  62. data/lib/beaker/ssh_connection.rb +198 -0
  63. data/lib/beaker/test_case.rb +225 -0
  64. data/lib/beaker/test_config.rb +148 -0
  65. data/lib/beaker/test_suite.rb +288 -0
  66. data/lib/beaker/utils.rb +7 -0
  67. data/lib/beaker/utils/ntp_control.rb +42 -0
  68. data/lib/beaker/utils/repo_control.rb +92 -0
  69. data/lib/beaker/utils/setup_helper.rb +77 -0
  70. data/lib/beaker/utils/validator.rb +27 -0
  71. data/spec/beaker/command_spec.rb +94 -0
  72. data/spec/beaker/dsl/assertions_spec.rb +104 -0
  73. data/spec/beaker/dsl/helpers_spec.rb +230 -0
  74. data/spec/beaker/dsl/install_utils_spec.rb +70 -0
  75. data/spec/beaker/dsl/outcomes_spec.rb +43 -0
  76. data/spec/beaker/dsl/roles_spec.rb +86 -0
  77. data/spec/beaker/dsl/structure_spec.rb +60 -0
  78. data/spec/beaker/dsl/wrappers_spec.rb +52 -0
  79. data/spec/beaker/host_spec.rb +95 -0
  80. data/spec/beaker/logger_spec.rb +117 -0
  81. data/spec/beaker/options_parsing_spec.rb +37 -0
  82. data/spec/beaker/puppet_command_spec.rb +128 -0
  83. data/spec/beaker/ssh_connection_spec.rb +39 -0
  84. data/spec/beaker/test_case_spec.rb +6 -0
  85. data/spec/beaker/test_suite_spec.rb +44 -0
  86. data/spec/mocks_and_helpers.rb +34 -0
  87. data/spec/spec_helper.rb +15 -0
  88. metadata +359 -0
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+
3
+ class ClassMixedWithDSLInstallUtils
4
+ include Beaker::DSL::InstallUtils
5
+ include Beaker::DSL::Structure
6
+ end
7
+
8
+ describe ClassMixedWithDSLInstallUtils do
9
+ context 'extract_repo_info_from' do
10
+ [{:protocol => 'git', :path => 'git://github.com/puppetlabs/project.git'},
11
+ {:protocol => 'ssh', :path => 'git@github.com:puppetlabs/project.git'},
12
+ {:protocol => 'https', :path => 'https://github.com:puppetlabs/project'},
13
+ {:protocol => 'file', :path => 'file:///home/example/project'}
14
+ ].each do |type|
15
+ it "handles #{type[:protocol]} uris" do
16
+ uri = "#{type[:path]}#master"
17
+ repo_info = subject.extract_repo_info_from uri
18
+ expect(repo_info[:name]).to be == 'project'
19
+ expect(repo_info[:path]).to be == type[:path]
20
+ expect(repo_info[:rev]).to be == 'master'
21
+ end
22
+ end
23
+ end
24
+
25
+ context 'order_packages' do
26
+ it 'orders facter, hiera before puppet, before anything else' do
27
+ named_repos = [
28
+ {:name => 'puppet_plugin'}, {:name => 'puppet'}, {:name => 'facter'}
29
+ ]
30
+ ordered_repos = subject.order_packages named_repos
31
+ expect( ordered_repos[0][:name] ).to be == 'facter'
32
+ expect( ordered_repos[1][:name] ).to be == 'puppet'
33
+ expect( ordered_repos[2][:name] ).to be == 'puppet_plugin'
34
+ end
35
+ end
36
+
37
+ context 'find_git_repo_versions' do
38
+ it 'returns a hash of :name => version' do
39
+ host = stub('Host')
40
+ repository = {:name => 'name'}
41
+ path = '/path/to/repo'
42
+ cmd = 'cd /path/to/repo/name && git describe || true'
43
+ logger = double.as_null_object
44
+
45
+ subject.should_receive( :logger ).and_return( logger )
46
+ subject.should_receive( :on ).with(host, cmd).and_yield
47
+ subject.should_receive( :stdout ).and_return( '2' )
48
+
49
+ version = subject.find_git_repo_versions(host, path, repository)
50
+
51
+ expect(version).to be == {'name' => '2'}
52
+ end
53
+ end
54
+
55
+ context 'install_from_git' do
56
+ it 'does a ton of stuff it probably shouldnt' do
57
+ repo = { :name => 'puppet',
58
+ :path => 'git://my.server.net/puppet.git',
59
+ :rev => 'master' }
60
+ path = '/path/to/repos'
61
+ host = { 'platform' => 'debian' }
62
+ logger = double.as_null_object
63
+
64
+ subject.should_receive( :logger ).any_number_of_times.and_return( logger )
65
+ subject.should_receive( :on ).exactly( 4 ).times
66
+
67
+ subject.install_from_git( host, path, repo )
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ class ClassMixedWithDSLOutcomes
4
+ include Beaker::DSL::Outcomes
5
+ end
6
+
7
+ describe ClassMixedWithDSLOutcomes do
8
+ let(:logger) { double }
9
+ before { subject.stub( :logger ).and_return( logger ) }
10
+
11
+ describe '#pass_test' do
12
+ it "logs the notification passed to it and raises PassTest" do
13
+ logger.should_receive( :notify ).with( /blah/ )
14
+ expect { subject.pass_test('blah') }.
15
+ to raise_error Beaker::DSL::Outcomes::PassTest
16
+ end
17
+ end
18
+
19
+ describe '#skip_test' do
20
+ it "logs the notification passed to it and raises SkipTest" do
21
+ logger.should_receive( :notify ).with( /blah/ )
22
+ expect { subject.skip_test('blah') }.
23
+ to raise_error Beaker::DSL::Outcomes::SkipTest
24
+ end
25
+ end
26
+
27
+ describe '#pending_test' do
28
+ it "logs the notification passed to it and raises PendingTest" do
29
+ logger.should_receive( :warn ).with( /blah/ )
30
+ expect { subject.pending_test('blah') }.
31
+ to raise_error Beaker::DSL::Outcomes::PendingTest
32
+ end
33
+ end
34
+
35
+ describe '#fail_test' do
36
+ it "logs the notification passed to it and raises FailTest" do
37
+ logger.should_receive( :warn )
38
+ logger.should_receive( :pretty_backtrace )
39
+ expect { subject.fail_test('blah') }.
40
+ to raise_error Beaker::DSL::Outcomes::FailTest
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,86 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ class ClassMixedWithDSLRoles
5
+ include Beaker::DSL::Roles
6
+ include Beaker::DSL::Outcomes
7
+ end
8
+
9
+ describe ClassMixedWithDSLRoles do
10
+
11
+ let(:hosts) { @hosts || Hash.new }
12
+ let(:agent1) { {'roles' => [ 'agent' ] } }
13
+ let(:agent2) { {'roles' => [ 'agent' ] } }
14
+ let(:a_and_dash) { {'roles' => [ 'agent', 'dashboard' ] } }
15
+ let(:custom) { {'roles' => [ 'custome_role' ] } }
16
+ let(:db) { {'roles' => [ 'database' ] } }
17
+ let(:master) { {'roles' => [ 'master', 'agent' ] } }
18
+ let(:monolith) do
19
+ {'roles' => [ 'agent', 'dashboard', 'database', 'master', 'custom_role' ] }
20
+ end
21
+
22
+ describe '#agents' do
23
+ it 'returns an array of hosts that are agents' do
24
+ @hosts = [ agent1, agent2, master ]
25
+ subject.should_receive( :hosts ).and_return( hosts )
26
+ expect( subject.agents ).to be == [ agent1, agent2, master ]
27
+ end
28
+
29
+ it 'and an empty array when none match' do
30
+ @hosts = [ db, custom ]
31
+ subject.should_receive( :hosts ).and_return( hosts )
32
+ expect( subject.agents ).to be == []
33
+ end
34
+ end
35
+ describe '#master' do
36
+ it 'returns the master if there is one' do
37
+ @hosts = [ master, agent1 ]
38
+ subject.should_receive( :hosts ).and_return( hosts )
39
+ expect( subject.master ).to be == master
40
+ end
41
+ it 'raises an error if there is more than one master' do
42
+ @hosts = [ master, monolith ]
43
+ subject.should_receive( :hosts ).and_return( hosts )
44
+ expect { subject.master }.to raise_error Beaker::DSL::FailTest
45
+ end
46
+ it 'and raises an error if there is no master' do
47
+ @hosts = [ agent1, agent2, custom ]
48
+ subject.should_receive( :hosts ).and_return( hosts )
49
+ expect { subject.master }.to raise_error Beaker::DSL::FailTest
50
+ end
51
+ end
52
+ describe '#dashboard' do
53
+ it 'returns the dashboard if there is one' do
54
+ @hosts = [ a_and_dash, agent1 ]
55
+ subject.should_receive( :hosts ).and_return( hosts )
56
+ expect( subject.dashboard ).to be == a_and_dash
57
+ end
58
+ it 'raises an error if there is more than one dashboard' do
59
+ @hosts = [ a_and_dash, monolith ]
60
+ subject.should_receive( :hosts ).and_return( hosts )
61
+ expect { subject.dashboard }.to raise_error Beaker::DSL::FailTest
62
+ end
63
+ it 'and raises an error if there is no dashboard' do
64
+ @hosts = [ agent1, agent2, custom ]
65
+ subject.should_receive( :hosts ).and_return( hosts )
66
+ expect { subject.dashboard }.to raise_error Beaker::DSL::FailTest
67
+ end
68
+ end
69
+ describe '#database' do
70
+ it 'returns the database if there is one' do
71
+ @hosts = [ db, agent1 ]
72
+ subject.should_receive( :hosts ).and_return( hosts )
73
+ expect( subject.database ).to be == db
74
+ end
75
+ it 'raises an error if there is more than one database' do
76
+ @hosts = [ db, monolith ]
77
+ subject.should_receive( :hosts ).and_return( hosts )
78
+ expect { subject.database }.to raise_error Beaker::DSL::FailTest
79
+ end
80
+ it 'and raises an error if there is no database' do
81
+ @hosts = [ agent1, agent2, custom ]
82
+ subject.should_receive( :hosts ).and_return( hosts )
83
+ expect { subject.database }.to raise_error Beaker::DSL::FailTest
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,60 @@
1
+ require 'spec_helper'
2
+
3
+ class ClassMixedWithDSLStructure
4
+ include Beaker::DSL::Structure
5
+ end
6
+
7
+ describe ClassMixedWithDSLStructure do
8
+ let(:logger) { Object.new }
9
+ describe '#step' do
10
+ it 'requires a name' do
11
+ expect { subject.step do; end }.to raise_error ArgumentError
12
+ end
13
+
14
+ it 'notifies the logger' do
15
+ subject.should_receive( :logger ).and_return( logger )
16
+ logger.should_receive( :notify )
17
+ subject.step 'blah'
18
+ end
19
+
20
+ it 'yields if a block is given' do
21
+ subject.should_receive( :logger ).and_return( logger )
22
+ logger.should_receive( :notify )
23
+ subject.should_receive( :foo )
24
+ subject.step 'blah' do
25
+ subject.foo
26
+ end
27
+ end
28
+ end
29
+
30
+ describe '#test_name' do
31
+ it 'requires a name' do
32
+ expect { subject.test_name do; end }.to raise_error ArgumentError
33
+ end
34
+
35
+ it 'notifies the logger' do
36
+ subject.should_receive( :logger ).and_return( logger )
37
+ logger.should_receive( :notify )
38
+ subject.test_name 'blah'
39
+ end
40
+
41
+ it 'yields if a block is given' do
42
+ subject.should_receive( :logger ).and_return( logger )
43
+ logger.should_receive( :notify )
44
+ subject.should_receive( :foo )
45
+ subject.test_name 'blah' do
46
+ subject.foo
47
+ end
48
+ end
49
+ end
50
+
51
+ describe '#teardown' do
52
+ it 'append a block to the @teardown var' do
53
+ teardown_array = double
54
+ subject.instance_variable_set :@teardown_procs, teardown_array
55
+ block = lambda { 'blah' }
56
+ teardown_array.should_receive( :<< ).with( block )
57
+ subject.teardown &block
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ class ClassMixedWithDSLWrappers
4
+ include Beaker::DSL::Wrappers
5
+ end
6
+
7
+ describe ClassMixedWithDSLWrappers do
8
+ let(:opts) { {'ENV' => default_opts} }
9
+ let(:default_opts) { Beaker::Command::DEFAULT_GIT_ENV }
10
+ describe '#facter' do
11
+ it 'should split out the options and pass "facter" as first arg to Command' do
12
+ Beaker::Command.should_receive( :new ).
13
+ with('facter', [ '-p' ], opts)
14
+ subject.facter( '-p' )
15
+ end
16
+ end
17
+
18
+ describe '#hiera' do
19
+ it 'should split out the options and pass "hiera" as first arg to Command' do
20
+ Beaker::Command.should_receive( :new ).
21
+ with('hiera', [ '-p' ], opts)
22
+ subject.hiera( '-p' )
23
+ end
24
+ end
25
+
26
+ describe '#puppet' do
27
+ it 'should split out the options and pass "puppet <blank>" to Command' do
28
+ merged_opts = {}
29
+ merged_opts['ENV'] = {:HOME => '/'}.merge( default_opts )
30
+ merged_opts[:server] = 'master'
31
+ Beaker::Command.should_receive( :new ).
32
+ with('puppet agent', [ '-tv' ], merged_opts)
33
+ subject.puppet( 'agent', '-tv', :server => 'master', 'ENV' => {:HOME => '/'})
34
+ end
35
+ end
36
+
37
+ describe '#host_command' do
38
+ it 'delegates to HostCommand.new' do
39
+ Beaker::HostCommand.should_receive( :new ).with( 'blah' )
40
+ subject.host_command( 'blah' )
41
+ end
42
+ end
43
+
44
+ describe 'deprecated puppet wrappers' do
45
+ %w( resource doc kick cert apply master agent filebucket ).each do |sub|
46
+ it "#{sub} delegates the proper info to #puppet" do
47
+ subject.should_receive( :puppet ).with( sub, 'blah' )
48
+ subject.send( "puppet_#{sub}", 'blah')
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,95 @@
1
+ require 'spec_helper'
2
+
3
+ module Beaker
4
+ describe Host do
5
+ let :config do
6
+ MockConfig.new({}, {'name' => {'platform' => @platform}}, @pe)
7
+ end
8
+
9
+ let(:options) { @options || Hash.new }
10
+ let(:host) { Host.create 'name', options, config }
11
+
12
+ it 'creates a windows host given a windows config' do
13
+ @platform = 'windows'
14
+ expect( host ).to be_a_kind_of Windows::Host
15
+ end
16
+
17
+ it( 'defaults to a unix host' ) { expect( host ).to be_a_kind_of Unix::Host }
18
+
19
+ it 'can be read like a hash' do
20
+ expect { host['value'] }.to_not raise_error NoMethodError
21
+ end
22
+
23
+ it 'can be written like a hash' do
24
+ host['value'] = 'blarg'
25
+ expect( host['value'] ).to be === 'blarg'
26
+ end
27
+
28
+
29
+ # it takes a command object and a hash of options,
30
+ # it acts on the host's logger and connection object
31
+ # it receives a result object from the connection#execute
32
+ # (which it's really just a confusing wrapper for)
33
+ # it controls the result objects logging and fails a test for TestCase
34
+ # if the exit_code doesn't match
35
+ # it returns the result object
36
+ it 'EXEC!'
37
+
38
+ # it takes a location and a destination
39
+ # it basically proxies that to the connection object
40
+ it 'do_scp_to logs info and proxies to the connection' do
41
+ logger = mock(:logger)
42
+ conn = mock(:connection)
43
+ @options = { :logger => logger }
44
+ host.instance_variable_set :@connection, conn
45
+ args = [ 'source', 'target', {} ]
46
+
47
+ logger.should_receive(:debug)
48
+ conn.should_receive(:scp_to).with(*args)
49
+
50
+ host.do_scp_to *args
51
+ end
52
+
53
+ it 'do_scp_from logs info and proxies to the connection' do
54
+ logger = mock(:logger)
55
+ conn = mock(:connection)
56
+ @options = { :logger => logger }
57
+ host.instance_variable_set :@connection, conn
58
+ args = [ 'source', 'target', {} ]
59
+
60
+ logger.should_receive(:debug)
61
+ conn.should_receive(:scp_from).with(*args)
62
+
63
+ host.do_scp_from *args
64
+ end
65
+ it 'interpolates to its "name"' do
66
+ expect( "#{host}" ).to be === 'name'
67
+ end
68
+
69
+
70
+ context 'merging defaults' do
71
+ it 'knows the difference between foss and pe' do
72
+ @pe = true
73
+ expect( host['puppetpath'] ).to be === '/etc/puppetlabs/puppet'
74
+ end
75
+
76
+ it 'correctly merges network configs over defaults?' do
77
+ overridden_config = MockConfig.new( {'puppetpath'=> '/i/do/what/i/want'},
78
+ {'name' => {} },
79
+ false )
80
+ merged_host = Host.create 'name', options, overridden_config
81
+ expect( merged_host['puppetpath'] ).to be === '/i/do/what/i/want'
82
+ end
83
+
84
+ it 'correctly merges host specifics over defaults' do
85
+ overriding_config = MockConfig.new( {},
86
+ {'name' => {
87
+ 'puppetpath' => '/utter/awesomeness'}
88
+ }, true )
89
+
90
+ merged_host = Host.create 'name', options, overriding_config
91
+ expect( merged_host['puppetpath'] ).to be === '/utter/awesomeness'
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,117 @@
1
+ require 'spec_helper'
2
+
3
+ module Beaker
4
+ describe Logger, :use_fakefs => true do
5
+ let(:my_io) { MockIO.new }
6
+ let(:logger) { Logger.new(my_io, :quiet => true) }
7
+
8
+
9
+ context 'new' do
10
+ it 'does not duplicate STDOUT when directly passed to it' do
11
+ stdout_logger = Logger.new STDOUT
12
+ expect( stdout_logger ).to have(1).destinations
13
+ end
14
+
15
+
16
+ context 'default for' do
17
+ its(:destinations) { should include(STDOUT) }
18
+ its(:color) { should be_nil }
19
+ its(:log_level) { should be :normal }
20
+ end
21
+ end
22
+
23
+
24
+ context 'it can' do
25
+ it 'open/create a file when a string is given to add_destination' do
26
+ logger.add_destination 'my_tmp_file'
27
+ expect( File.exists?( 'my_tmp_file' ) ).to be_true
28
+
29
+ io = logger.destinations.select {|d| d.respond_to? :path }.first
30
+ expect( io.path ).to match /my_tmp_file/
31
+ end
32
+
33
+ it 'remove destinations with the remove_destinations method' do
34
+ logger.add_destination 'my_file'
35
+
36
+ logger.remove_destination my_io
37
+ logger.remove_destination 'my_file'
38
+
39
+ expect( logger.destinations ).to be_empty
40
+ end
41
+
42
+ it 'strip colors from arrays of input' do
43
+ stripped = logger.strip_colors_from [ "\e[00;30m text! \e[00;00m" ]
44
+ expect( stripped ).to be === [ ' text! ' ]
45
+ end
46
+
47
+ it 'colors strings if @color is set' do
48
+ colorized_logger = Logger.new my_io, :color => true, :quiet => true
49
+
50
+ my_io.should_receive( :print ).with "\e[00;30m"
51
+ my_io.should_receive( :print )
52
+ my_io.should_receive( :puts ).with 'my string'
53
+
54
+ colorized_logger.optionally_color "\e[00;30m", 'my string'
55
+ end
56
+
57
+
58
+ context 'at debug log_level' do
59
+ subject( :debug_logger ) { Logger.new( my_io,
60
+ :debug => true,
61
+ :quiet => true,
62
+ :color => true )
63
+ }
64
+
65
+ its( :is_debug? ) { should be_true }
66
+ its( :is_warn? ) { should be_true }
67
+
68
+
69
+ context 'successfully print' do
70
+ before do
71
+ my_io.stub :puts
72
+ my_io.should_receive( :print ).at_least :twice
73
+ end
74
+
75
+ it( 'warnings' ) { debug_logger.warn 'IMA WARNING!' }
76
+ it( 'debugs' ) { debug_logger.debug 'IMA DEBUGGING!' }
77
+ it( 'successes' ) { debug_logger.success 'SUCCESS!' }
78
+ it( 'errors' ) { debug_logger.error 'ERROR!' }
79
+ it( 'host_output' ) { debug_logger.host_output 'ERROR!' }
80
+ end
81
+ end
82
+
83
+ context 'at normal log_level' do
84
+ subject( :normal_logger ) { Logger.new( my_io,
85
+ :quiet => true,
86
+ :color => true )
87
+ }
88
+
89
+ its( :is_debug? ) { should be_false }
90
+ its( :is_warn? ) { should be_false }
91
+
92
+
93
+ context 'skip' do
94
+ before do
95
+ my_io.should_not_receive :puts
96
+ my_io.should_not_receive :print
97
+ end
98
+
99
+ it( 'warnings' ) { normal_logger.warn 'NOT A WARNING!' }
100
+ it( 'debugs' ) { normal_logger.debug 'NOT DEBUGGING!' }
101
+ end
102
+
103
+
104
+ context 'but print' do
105
+ before do
106
+ my_io.should_receive :puts
107
+ my_io.should_receive( :print ).twice
108
+ end
109
+
110
+ it( 'successes' ) { normal_logger.success 'SUCCESS!' }
111
+ it( 'notifications' ) { normal_logger.notify 'NOTFIY!' }
112
+ it( 'errors' ) { normal_logger.error 'ERROR!' }
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end