Class: RspecRequestHelpers::Helpers::ClassMethods::VarsDSL
- Inherits:
-
Object
- Object
- RspecRequestHelpers::Helpers::ClassMethods::VarsDSL
- Defined in:
- lib/rspec_request_helpers/helpers.rb
Instance Method Summary collapse
-
#initialize(klass) ⇒ VarsDSL
constructor
A new instance of VarsDSL.
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize(klass) ⇒ VarsDSL
44 45 46 |
# File 'lib/rspec_request_helpers/helpers.rb', line 44 def initialize(klass) @klass = klass end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/rspec_request_helpers/helpers.rb', line 48 def method_missing(method_name, *args, &block) case method_name when /!$/ @klass.class_eval { let!(:"#{method_name.to_s.sub(/!$/,'')}", &block) } else @klass.class_eval { let(method_name, &block) } end end |