Sha256: 503301ad2c803d72dc35832c6e4a1af9552da0e5614c4c4e7316a59278370d7c

Contents?: true

Size: 1.13 KB

Versions: 44

Compression:

Stored size: 1.13 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', &block)
    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', &block)
  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, &block)
    exception = assert_raise exception_klass, &block
    assert_equal exception.message, message,
      "The expected message was #{message} but your exception throwed #{exception.message}"
  end
end

Version data entries

44 entries across 44 versions & 7 rubygems

Version Path
devbootsrap-0.0.7 test/support/assertions.rb
devbootsrap-0.0.6 test/support/assertions.rb
devbootsrap-0.0.5 test/support/assertions.rb
devbootsrap-0.0.4 test/support/assertions.rb
devbootsrap-0.0.3 test/support/assertions.rb
devbootsrap-0.0.2 test/support/assertions.rb
devbootsrap-0.0.1 test/support/assertions.rb
devise-3.2.4 test/support/assertions.rb
devise-3.2.3 test/support/assertions.rb
devise-3.2.2 test/support/assertions.rb
devise-3.2.1 test/support/assertions.rb
devise-3.1.2 test/support/assertions.rb
devise-3.0.4 test/support/assertions.rb
devise-2.2.8 test/support/assertions.rb
devise-3.2.0 test/support/assertions.rb
devise-3.1.1 test/support/assertions.rb
devise-3.1.0 test/support/assertions.rb
devise-2.1.4 test/support/assertions.rb
devise-2.2.7 test/support/assertions.rb
devise-3.0.3 test/support/assertions.rb