Class: MCollective::Test::ApplicationTest
- Inherits:
-
Object
- Object
- MCollective::Test::ApplicationTest
- Includes:
- Util
- Defined in:
- lib/mcollective/test/application_test.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Returns the value of attribute application.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#plugin ⇒ Object
readonly
Returns the value of attribute plugin.
Instance Method Summary collapse
-
#initialize(application, options = {}) ⇒ ApplicationTest
constructor
A new instance of ApplicationTest.
- #make_create_client ⇒ Object
Methods included from Util
#create_config_mock, #create_connector_mock, #create_facts_mock, #create_logger_mock, #create_response, #load_agent, #load_application, #mock_validators
Constructor Details
#initialize(application, options = {}) ⇒ ApplicationTest
Returns a new instance of ApplicationTest.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mcollective/test/application_test.rb', line 8 def initialize(application, ={}) config = [:config] || {} facts = [:facts] || {"fact" => "value"} ARGV.clear @config = create_config_mock(config) @application = application.to_s @logger = create_logger_mock @plugin = load_application(@application, [:application_file]) @plugin.stubs(:printrpcstats) @plugin.stubs(:puts) @plugin.stubs(:printf) make_create_client end |
Instance Attribute Details
#application ⇒ Object (readonly)
Returns the value of attribute application.
4 5 6 |
# File 'lib/mcollective/test/application_test.rb', line 4 def application @application end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/mcollective/test/application_test.rb', line 4 def config @config end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
4 5 6 |
# File 'lib/mcollective/test/application_test.rb', line 4 def logger @logger end |
#plugin ⇒ Object (readonly)
Returns the value of attribute plugin.
4 5 6 |
# File 'lib/mcollective/test/application_test.rb', line 4 def plugin @plugin end |
Instance Method Details
#make_create_client ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/mcollective/test/application_test.rb', line 26 def make_create_client @plugin.instance_eval " def create_client(client) mock_client = Mocha::Mock.new mock_client.stubs(:progress=) mock_client.stubs(:progress) yield(mock_client) if block_given? MCollective::Application::Facts.any_instance.expects(:rpcclient).with(client).returns(mock_client) mock_client end " end |