module ShouldaMatchmakers::Model::ActiveRecord::Matchmaker::HaveReadonlyAttribute

Public Instance Methods

have_readonly_attribute_matcher_tests() click to toggle source
# File lib/model/active_record/matchmakers/have_readonly_attribute.rb, line 7
def have_readonly_attribute_matcher_tests
  readonly_attributes = @app_class_name.constantize.readonly_attributes
  if readonly_attributes.present?
    generate_have_readonly_attribute_matcher_tests(readonly_attributes)
  else
    []
  end
end

Private Instance Methods

generate_have_readonly_attribute_matcher_tests(readonly_attributes) click to toggle source
# File lib/model/active_record/matchmakers/have_readonly_attribute.rb, line 19
def generate_have_readonly_attribute_matcher_tests(readonly_attributes)
  readonly_attribute_tests = []
  readonly_attributes.each do |attribute|
    readonly_attribute_test = "  it { is_expected.to have_readonly_attribute(:#{ attribute }) }"
    readonly_attribute_tests = append_element(readonly_attribute_test, readonly_attribute_tests)
  end
  format_tests(readonly_attribute_tests)
end