module MSpectator::ExampleGroup
Public Class Methods
included(group)
click to toggle source
# File lib/mspectator/example.rb, line 11 def self.included(group) group.before(:all) do @mc_clients ||= {} end end
Public Instance Methods
apply_filters(mc, example)
click to toggle source
# File lib/mspectator/example.rb, line 39 def apply_filters (mc, example) classes = example.metadata[:classes] || [] facts = example.metadata[:facts] || {} mc.compound_filter example.example_group.top_level_description unless classes.empty? and facts.empty? classes.each do |c| mc.class_filter c end facts.each do |f, v| mc.fact_filter f, v end end mc end
check_spec(example, action, values)
click to toggle source
# File lib/mspectator/example.rb, line 54 def check_spec (example, action, values) spec_mc = filtered_mc('spec', example) passed = [] failed = [] spec_mc.check(:action => action, :values => values).each do |resp| if resp[:data][:passed] passed << resp[:sender] else failed << resp[:sender] end end return passed, failed end
filtered_mc(agent, example)
click to toggle source
# File lib/mspectator/example.rb, line 31 def filtered_mc(agent, example) mc = mc_client(agent) # There is no need to reset only before :group currently # so we need to reset before applying filters mc.reset apply_filters(mc, example) end
get_fqdn(example)
click to toggle source
# File lib/mspectator/example.rb, line 68 def get_fqdn (example) util_mc = self.mc_client('rpcutil') util_mc.progress = false util_mc = apply_filters util_mc, example fqdn = [] util_mc.get_fact(:fact => 'fqdn').each do |resp| fqdn << resp[:data][:value] end fqdn end
mc_client(agent)
click to toggle source
# File lib/mspectator/example.rb, line 21 def mc_client(agent) unless mc_clients.has_key? agent # Can't pass :progress_bar to rpcclient()? new = rpcclient(agent) new.progress = false mc_clients[agent] = new end mc_clients[agent] end
mc_clients()
click to toggle source
# File lib/mspectator/example.rb, line 17 def mc_clients @mc_clients ||= {} end
subject()
click to toggle source
# File lib/mspectator/example.rb, line 7 def subject @subject ||= self.class.top_level_description end