Class: Rectify::StubForm
- Inherits:
-
Object
- Object
- Rectify::StubForm
- Defined in:
- lib/rectify/rspec/stub_form.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ StubForm
constructor
A new instance of StubForm.
- #invalid? ⇒ Boolean
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize(attributes) ⇒ StubForm
Returns a new instance of StubForm.
5 6 7 |
# File 'lib/rectify/rspec/stub_form.rb', line 5 def initialize(attributes) @attributes = attributes end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rectify/rspec/stub_form.rb', line 13 def method_missing(method_name, *args, &block) if attributes.key?(method_name) attributes[method_name] else super end end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/rectify/rspec/stub_form.rb', line 3 def attributes @attributes end |
Instance Method Details
#invalid? ⇒ Boolean
9 10 11 |
# File 'lib/rectify/rspec/stub_form.rb', line 9 def invalid? !valid? end |
#respond_to_missing?(method_name, _include_private = false) ⇒ Boolean
21 22 23 |
# File 'lib/rectify/rspec/stub_form.rb', line 21 def respond_to_missing?(method_name, _include_private = false) attributes.key?(method_name) end |