Sha256: dcd8a78e41bdce14e39c00993be788c3687f7492657f0b043c001febd240588d

Contents?: true

Size: 779 Bytes

Versions: 13

Compression:

Stored size: 779 Bytes

Contents

class ActiveSupport::TestCase
  def setup_mailer
    ActionMailer::Base.deliveries = []
  end

  def store_translations(locale, translations, &block)
    begin
      I18n.backend.store_translations locale, translations
      yield
    ensure
      I18n.reload!
    end
  end

  # Helpers for creating new users
  #
  def generate_unique_email
    @@email_count ||= 0
    @@email_count += 1
    "test#{@@email_count}@email.com"
  end

  def valid_attributes(attributes={})
    { :email => generate_unique_email,
      :password => '123456',
      :password_confirmation => '123456' }.update(attributes)
  end

  def new_user(attributes={})
    User.new(valid_attributes(attributes))
  end

  def create_user(attributes={})
    User.create!(valid_attributes(attributes))
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
devise-0.9.2 test/support/model_tests_helper.rb
devise-0.9.1 test/support/model_tests_helper.rb
devise-0.9.0 test/support/model_tests_helper.rb
devise-0.8.2 test/support/model_tests_helper.rb
devise-0.8.1 test/support/model_tests_helper.rb
devise-0.8.0 test/support/model_tests_helper.rb
devise-0.7.5 test/support/model_tests_helper.rb
devise-0.7.4 test/support/model_tests_helper.rb
devise-0.3.0 test/support/model_tests_helper.rb
devise-0.2.3 test/support/model_tests_helper.rb
devise-0.2.2 test/support/model_tests_helper.rb
devise-0.2.1 test/support/model_tests_helper.rb
devise-0.2.0 test/support/model_tests_helper.rb