Sha256: 9dab3f2551aa31ebacba6b2ec660ceada943d4ff8187a7f44b157b11a554263f

Contents?: true

Size: 802 Bytes

Versions: 49

Compression:

Stored size: 802 Bytes

Contents

module UserTestHelper
  VALID_USER_PARAMS = {
    :name => 'John Doe',
    :login => 'jdoe',
    :password => 'coolness',
    :password_confirmation => 'coolness',
    :email => 'jdoe@gmail.com'
  }
  
  def user_params(options = {})
    params = VALID_USER_PARAMS.dup
    params.merge!(:login => @user_login) if @user_login
    params.merge!(options)
  end
  
  def destroy_test_user(login = @user_login)
    while user = get_test_user(login) do
      user.destroy
    end
  end
  
  def get_test_user(login = @user_login)
    User.find_by_login(login)
  end
  
  def create_test_user(options = {})
    options[:login] ||= @user_login if @user_login
    user = User.new user_params(options)
    if user.save
      user
    else
      raise "user <#{user.inspect}> could not be saved"
    end
  end
end

Version data entries

49 entries across 49 versions & 4 rubygems

Version Path
radiant-1.1.4 test/helpers/user_test_helper.rb
radiant-1.1.3 test/helpers/user_test_helper.rb
radiant-1.1.2 test/helpers/user_test_helper.rb
radiant-1.1.1 test/helpers/user_test_helper.rb
radiant-1.1.0 test/helpers/user_test_helper.rb
radiant-1.1.0.rc1 test/helpers/user_test_helper.rb
radiant-1.1.0.beta test/helpers/user_test_helper.rb
radiant-1.0.1 test/helpers/user_test_helper.rb
radiant-1.1.0.alpha test/helpers/user_test_helper.rb
radiant-1.0.0 test/helpers/user_test_helper.rb
radiant-1.0.0.rc5 test/helpers/user_test_helper.rb
radiant-1.0.0.rc4 test/helpers/user_test_helper.rb
radiant-1.0.0.rc3 test/helpers/user_test_helper.rb
radiant-1.0.0.rc2 test/helpers/user_test_helper.rb
radiant-1.0.0.rc1 test/helpers/user_test_helper.rb
radiant-rails3-0.1 test/helpers/user_test_helper.rb
radiantcms-couchrest_model-0.2.4 test/helpers/user_test_helper.rb
radiantcms-couchrest_model-0.2.2 test/helpers/user_test_helper.rb
radiantcms-couchrest_model-0.2.1 test/helpers/user_test_helper.rb
radiantcms-couchrest_model-0.2 test/helpers/user_test_helper.rb