Module: Speccify::Extension
- Defined in:
- lib/speccify.rb
Instance Method Summary collapse
-
#def_matcher(matcher_name, &block) ⇒ Object
todo this should really extend main.
-
#method_missing(name, *args, &block) ⇒ Object
todo this should extend TestCase.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
todo this should extend TestCase
167 168 169 170 171 172 173 174 175 |
# File 'lib/speccify.rb', line 167 def method_missing(name, *args, &block) if (name.to_s =~ /^be_(.+)/) Speccify::Functions::build_matcher(name, args) do |given, matcher, args| given.send(($1 + "?").to_sym) end else raise NoMethodError.new(name.to_s) end end |
Instance Method Details
#def_matcher(matcher_name, &block) ⇒ Object
todo this should really extend main
161 162 163 164 165 |
# File 'lib/speccify.rb', line 161 def def_matcher(matcher_name, &block) self.class.send :define_method, matcher_name do |*args| Speccify::Functions::build_matcher(matcher_name, args, &block) end end |