Sha256: 79e61fa446ffc43b4908bb36b75d2190087a318d657e797878717edf5c52d099

Contents?: true

Size: 905 Bytes

Versions: 2

Compression:

Stored size: 905 Bytes

Contents

require 'helper'

class TestClient < Test::Unit::TestCase
  def setup
    Parse.init
  end
  
  def test_simple_save
    test_save = Parse::Object.new "TestSave"
    test_save["foo"] = "bar"
    test_save.save

    assert_equal test_save["foo"], "bar"
    assert_equal test_save[Parse::Protocol::KEY_CREATED_AT].class, String
    assert_equal test_save[Parse::Protocol::KEY_OBJECT_ID].class, String
  end
  
  def test_update
    foo = Parse::Object.new "TestSave"
    foo["age"] = 20
    foo.save
    
    assert_equal foo["age"], 20
    assert_equal foo[Parse::Protocol::KEY_UPDATED_AT], nil
    
    foo["age"] = 40
    foo.save
    
    assert_equal foo["age"], 40
    assert_equal foo[Parse::Protocol::KEY_UPDATED_AT].class, String
  end
  
  def test_destroy
    d = Parse::Object.new "toBeDeleted"
    d["foo"] = "bar"
    d.save
    d.parse_delete
    
    assert_equal d.keys.length, 0
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
parse-ruby-client-0.0.5 test/test_client.rb
parse-ruby-client-0.0.4 test/test_client.rb