1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00
heartcombo--devise/test/support/assertions_helper.rb

37 lines
874 B
Ruby

class ActiveSupport::TestCase
def assert_not(assertion)
assert !assertion
end
def assert_blank(assertion)
assert assertion.blank?
end
def assert_not_blank(assertion)
assert !assertion.blank?
end
alias :assert_present :assert_not_blank
def assert_email_sent(&block)
assert_difference('ActionMailer::Base.deliveries.size') { yield }
end
def assert_email_not_sent(&block)
assert_no_difference('ActionMailer::Base.deliveries.size') { yield }
end
# Execute the block setting the given values and restoring old values after
# the block is executed.
def swap(object, new_values)
old_values = {}
new_values.each do |key, value|
old_values[key] = object.send key
object.send :"#{key}=", value
end
yield
ensure
old_values.each do |key, value|
object.send :"#{key}=", value
end
end
end