Method: Expected::Matchers::HaveAttrWriterMatcher#initialize

Defined in:
lib/expected/matchers/have_attr_writer.rb

#initialize(attribute) ⇒ HaveAttrWriterMatcher

Returns a new instance of HaveAttrWriterMatcher.

Parameters:

  • attribute (String, Symbol)

    The attribute the #subject is expected to have an attr_writer for



25
26
27
28
29
30
# File 'lib/expected/matchers/have_attr_writer.rb', line 25

def initialize(attribute)
  unless attribute.is_a?(String) || attribute.is_a?(Symbol)
    raise 'HaveAttrWriterMatcher attribute must be a String or Symbol'
  end
  @attribute = attribute.to_sym
end