Sha256: 4bf85b69db7ee01f6d3f99f76f3b8c53a949f779e217a30353fd07d6d29298f2

Contents?: true

Size: 871 Bytes

Versions: 27

Compression:

Stored size: 871 Bytes

Contents

class ActiveSupport::TestCase
  VALID_AUTHENTICATION_TOKEN = 'AbCdEfGhIjKlMnOpQrSt'.freeze

  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={})
    { :username => "usertest",
      :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

27 entries across 22 versions & 6 rubygems

Version Path
graffititracker_devise-1.0.11 test/support/tests_helper.rb
devise-1.0.11 test/support/tests_helper.rb
devise-1.0.10 test/support/tests_helper.rb
devise_ennder-1.4.1.0.9 test/support/tests_helper.rb
devise_ennder-1.4.1.0.9 test/rails_app/vendor/plugins/devise/test/support/tests_helper.rb
devise_ennder-1.3.1.0.9 test/rails_app/vendor/plugins/devise/test/support/tests_helper.rb
devise_ennder-1.3.1.0.9 test/support/tests_helper.rb
devise_ennder-1.2.1.0.9 test/support/tests_helper.rb
devise_ennder-1.2.1.0.9 test/rails_app/vendor/plugins/devise/test/support/tests_helper.rb
devise_ennder-1.1.1.0.9 test/support/tests_helper.rb
devise_ennder-1.1.1.0.9 test/rails_app/vendor/plugins/devise/test/support/tests_helper.rb
devise_ennder-1.0.1.0.9 test/support/tests_helper.rb
devise_ennder-1.0.1.0.9 test/rails_app/vendor/plugins/devise/test/support/tests_helper.rb
devise-1.0.9 test/support/tests_helper.rb
dcu-devise-1.0.7 test/support/tests_helper.rb
devise-1.0.8 test/support/tests_helper.rb
ivanvc-devise-1.0.7.1 test/support/tests_helper.rb
devise-1.0.7 test/support/tests_helper.rb
devise-1.0.6 test/support/tests_helper.rb
devise-1.0.5 test/support/tests_helper.rb