Sha256: e98c2b701264416b5203b86e60b036efc007b8ee287b4502bc013308b65ce1b3

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

require 'active_support/test_case'

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(address = nil, &block)
    assert_difference('ActionMailer::Base.deliveries.size') { yield }
    if address.present?
      assert_equal address, ActionMailer::Base.deliveries.last['to'].to_s
    end
  end

  def assert_email_not_sent(&block)
    assert_no_difference('ActionMailer::Base.deliveries.size') { yield }
  end

  def assert_same_content(result, expected)
    assert expected.size == result.size, "the arrays doesn't have the same size"
    expected.each do |element|
      assert result.include?(element), "The array doesn't include '#{element}'."
    end
  end

  def assert_raise_with_message(exception_klass, message)
    exception = assert_raise exception_klass do
      yield
    end

    assert_equal exception.message, message, "The expected message was #{message} but your exception throwed #{exception.message}"
  end
end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
sunrise-cms-0.3.3 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/test/support/assertions.rb
sunrise-cms-0.3.2 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/test/support/assertions.rb
sunrise-cms-0.3.1 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/test/support/assertions.rb
sunrise-cms-0.3.0 vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/test/support/assertions.rb
sunrise-cms-0.3.0.rc vendor/bundle/ruby/1.9.1/gems/devise-2.1.0/test/support/assertions.rb
devise-2.1.0 test/support/assertions.rb
devise-2.1.0.rc2 test/support/assertions.rb
upstream-devise-2.1.0.rc test/support/assertions.rb
devise-2.1.0.rc test/support/assertions.rb