Class: Rectify::StubForm

Inherits:
Object
  • Object
show all
Defined in:
lib/rectify/rspec/stub_form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

Returns:

  • (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

Returns:

  • (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