mcollective-test 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,6 +7,7 @@ module MCollective
7
7
 
8
8
  def initialize(agent, options={})
9
9
  config = options[:config]
10
+
10
11
  facts = options[:facts] || {"fact" => "value"}
11
12
 
12
13
  @config = create_config_mock(config)
@@ -13,6 +13,8 @@ module MCollective
13
13
  end
14
14
 
15
15
  def create_config_mock(config)
16
+ pluginconf = {}
17
+
16
18
  cfg = Mocha::Mock.new('config')
17
19
  cfg.stubs(:configured).returns(true)
18
20
  cfg.stubs(:rpcauthorization).returns(false)
@@ -22,10 +24,14 @@ module MCollective
22
24
  cfg.stubs(:identity).returns("rspec_tests")
23
25
  cfg.stubs(:logger_type).returns("console")
24
26
  cfg.stubs(:loglevel).returns("error")
27
+ cfg.stubs(:pluginconf).returns(pluginconf)
25
28
 
26
29
  if config
27
30
  config.each_pair do |k, v|
28
31
  cfg.send(:stubs, k).returns(v)
32
+ if k =~ /^plugin.(.+)/
33
+ pluginconf[$1] = v
34
+ end
29
35
  end
30
36
 
31
37
  if config.include?(:libdir)
@@ -37,6 +43,7 @@ module MCollective
37
43
  end
38
44
  end
39
45
 
46
+
40
47
  MCollective::Config.stubs(:instance).returns(cfg)
41
48
 
42
49
  cfg
@@ -98,13 +105,9 @@ module MCollective
98
105
  MCollective::PluginManager.loadclass(classname)
99
106
  end
100
107
 
101
- # Stub out startup_hook as this feature should probably
102
- # be deprecated and it's really hard to test
103
-
104
108
  klass = MCollective::Agent.const_get(agent.capitalize)
105
109
 
106
110
  klass.any_instance.stubs("load_ddl").returns(true)
107
- klass.any_instance.stubs(:startup_hook).returns(true)
108
111
  MCollective::RPC::Request.any_instance.stubs(:validate!).returns(true)
109
112
 
110
113
  MCollective::PluginManager << {:type => "#{agent}_agent", :class => classname, :single_instance => false}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcollective-test
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
8
+ - 3
9
9
  - 0
10
- version: 0.2.0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - R.I.Pienaar
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-09-14 00:00:00 +01:00
18
+ date: 2012-10-17 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21