Module: EvelpidonTestHelpers::ActiveModel::DefaultModelValues::Assertions
- Included in:
- ActiveSupport::TestCase
- Defined in:
- lib/evelpidon_test_helpers/active_model/default_model_values.rb
Instance Method Summary collapse
- #assert_default_model_value(attribute, value) ⇒ Object
- #assert_default_value(object, attribute, value) ⇒ Object
Instance Method Details
#assert_default_model_value(attribute, value) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/evelpidon_test_helpers/active_model/default_model_values.rb', line 10 def assert_default_model_value(attribute, value) model = self.class.to_s.gsub("Controller", "").gsub("Test", "").constantize instance = model.new assert_default_value(instance, attribute, value) end |
#assert_default_value(object, attribute, value) ⇒ Object
5 6 7 8 |
# File 'lib/evelpidon_test_helpers/active_model/default_model_values.rb', line 5 def assert_default_value(object, attribute, value) assert_valid_attribute object, attribute.to_sym assert_equal value, object.send(attribute.to_sym) end |