Sha256: 3fd7e9432cef6dcf2f5625467a31bfc2e2fe65b7ac1b2c0739c27babca02239d

Contents?: true

Size: 693 Bytes

Versions: 15

Compression:

Stored size: 693 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

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
devise_invitable-1.5.3 test/model_tests_helper.rb
devise_invitable-1.5.2 test/model_tests_helper.rb
devise_invitable-1.5.1 test/model_tests_helper.rb
devise_invitable-1.5.0 test/model_tests_helper.rb
devise_invitable-1.4.2 test/model_tests_helper.rb
devise_invitable-1.4.1 test/model_tests_helper.rb
devise_invitable-1.4.0 test/model_tests_helper.rb
devise_invitable-1.3.6 test/model_tests_helper.rb
devise_invitable-1.3.5 test/model_tests_helper.rb
devise_invitable-1.3.4 test/model_tests_helper.rb
devise_invitable-1.3.3 test/model_tests_helper.rb
devise_invitable-1.3.2 test/model_tests_helper.rb
devise_invitable-1.3.1 test/model_tests_helper.rb
devise_invitable-1.3.0 test/model_tests_helper.rb
devise_invitable-1.2.1 test/model_tests_helper.rb