Sha256: dc5617996d6531271eba56cd0067d6d0fb00442fc45b3c0725a478c83cc74931

Contents?: true

Size: 880 Bytes

Versions: 8

Compression:

Stored size: 880 Bytes

Contents

require 'helper'

class TestUser < Test::Unit::TestCase
  
  def setup
    Parse.init
  end

  def test_save
    username = rand.to_s
    data = {
      :username => username,
      :password => "topsecret"
    }
    user = Parse::User.new data
    user.save
    assert_equal user[Parse::Protocol::KEY_OBJECT_ID].class, String
    assert_equal user[Parse::Protocol::KEY_CREATED_AT].class, String
  end
  
  def test_login
    u = "alan" + rand(10000000000000).to_s
    data = {
      :username => u, 
      :password => "secret"
    }

    user = Parse::User.new(data)

    user.save
    
    assert_equal user["username"], u
    assert_equal user[Parse::Protocol::KEY_USER_SESSION_TOKEN].class, String
    
    login = Parse::User.authenticate(u, "secret")
    
    assert_equal login["username"], user["username"]
    assert_equal login["sessionToken"].class, String
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
parse-ruby-client-0.1.3 test/test_user.rb
parse-ruby-client-0.1.2 test/test_user.rb
parse-ruby-client-0.1.1 test/test_user.rb
parse-ruby-client-0.1.0 test/test_user.rb
parse-ruby-client-0.0.7 test/test_user.rb
parse-ruby-client-0.0.6 test/test_user.rb
parse-ruby-client-0.0.5 test/test_user.rb
parse-ruby-client-0.0.4 test/test_user.rb