module MR::TestHelpers

Public Instance Methods

assert_association_saved(model, association, expected_value) click to toggle source
# File lib/mr/test_helpers.rb, line 18
def assert_association_saved(model, association, expected_value)
  with_backtrace(caller) do
    AssociationSavedAssertion.new(model, association, expected_value).run(self)
  end
end
assert_field_saved(model, field, expected_value) click to toggle source
# File lib/mr/test_helpers.rb, line 42
def assert_field_saved(model, field, expected_value)
  with_backtrace(caller) do
    FieldSavedAssertion.new(model, field, expected_value).run(self)
  end
end
assert_model_destroyed(model) click to toggle source
# File lib/mr/test_helpers.rb, line 30
def assert_model_destroyed(model)
  with_backtrace(caller) do
    ModelDestroyedAssertion.new(model).run(self)
  end
end
assert_model_saved(model) click to toggle source
# File lib/mr/test_helpers.rb, line 54
def assert_model_saved(model)
  with_backtrace(caller) do
    ModelSavedAssertion.new(model).run(self)
  end
end
assert_not_association_saved(model, association, expected_value) click to toggle source
# File lib/mr/test_helpers.rb, line 24
def assert_not_association_saved(model, association, expected_value)
  with_backtrace(caller) do
    AssociationNotSavedAssertion.new(model, association, expected_value).run(self)
  end
end
assert_not_field_saved(model, field, expected_value) click to toggle source
# File lib/mr/test_helpers.rb, line 48
def assert_not_field_saved(model, field, expected_value)
  with_backtrace(caller) do
    FieldNotSavedAssertion.new(model, field, expected_value).run(self)
  end
end
assert_not_model_destroyed(model) click to toggle source
# File lib/mr/test_helpers.rb, line 36
def assert_not_model_destroyed(model)
  with_backtrace(caller) do
    ModelNotDestroyedAssertion.new(model).run(self)
  end
end
assert_not_model_saved(model) click to toggle source
# File lib/mr/test_helpers.rb, line 60
def assert_not_model_saved(model)
  with_backtrace(caller) do
    ModelNotSavedAssertion.new(model).run(self)
  end
end
model_reset_save_called(model) { |model| ... } click to toggle source
# File lib/mr/test_helpers.rb, line 9
def model_reset_save_called(model, &block)
  fake_record = model.record
  if !fake_record.kind_of?(MR::FakeRecord)
    raise ArgumentError, "model must be using a fake record"
  end
  yield model if block
  fake_record.reset_save_called
end