Class: ExpectationMatcher
- Inherits:
-
Object
- Object
- ExpectationMatcher
- Defined in:
- lib/expectation_matcher.rb
Class Method Summary collapse
-
.initialize_plugins ⇒ Object
dynamically generates methods that invoke “check” on all available plugins.
Instance Method Summary collapse
-
#check(plugin, response, testcase) ⇒ Object
dispatches incoming matching requests.
-
#initialize(excludes = nil) ⇒ ExpectationMatcher
constructor
A new instance of ExpectationMatcher.
Constructor Details
#initialize(excludes = nil) ⇒ ExpectationMatcher
Returns a new instance of ExpectationMatcher.
10 11 12 |
# File 'lib/expectation_matcher.rb', line 10 def initialize(excludes=nil) @excludes = excludes || [] end |
Class Method Details
.initialize_plugins ⇒ Object
dynamically generates methods that invoke “check” on all available plugins
20 21 22 23 24 25 26 27 |
# File 'lib/expectation_matcher.rb', line 20 def self.initialize_plugins Checker.available_plugins.each do |plugin| define_method(plugin.underscore) do |response, testcase| eval(plugin).new(testcase, response, @excludes).check end private plugin.underscore.to_sym end end |
Instance Method Details
#check(plugin, response, testcase) ⇒ Object
dispatches incoming matching requests
15 16 17 |
# File 'lib/expectation_matcher.rb', line 15 def check(plugin, response, testcase) self.send(plugin.underscore, response, testcase) end |