class Rectify::StubForm

Attributes

attributes[R]
valid[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/rectify/rspec/stub_form.rb, line 5
def initialize(attributes)
  @valid = attributes.fetch(:valid?, false)
  @attributes = attributes.except!(:valid?)
end

Public Instance Methods

invalid?() click to toggle source
# File lib/rectify/rspec/stub_form.rb, line 14
def invalid?
  !valid?
end
method_missing(method_name, *args, &block) click to toggle source
Calls superclass method
# File lib/rectify/rspec/stub_form.rb, line 18
def method_missing(method_name, *args, &block)
  if attributes.key?(method_name)
    attributes[method_name]
  elsif method_name.to_s.ends_with?("=")
    attribute_name = method_name.to_s.chomp("=").to_sym
    attributes[attribute_name] = args.first
  else
    super
  end
end
respond_to_missing?(method_name, _include_private = false) click to toggle source
# File lib/rectify/rspec/stub_form.rb, line 29
def respond_to_missing?(method_name, _include_private = false)
  attributes.key?(method_name)
end
valid?() click to toggle source
# File lib/rectify/rspec/stub_form.rb, line 10
def valid?
  valid
end