Sha256: b81328008d933d946d172e2b5b73be3f94d672d2a4c00017da3cbb36ce2f9466

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require 'helper'

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

  def test_new?
  	post = Parse::Object.new "Post"
  	assert_equal post.new?, true
  	post.save
  	assert_equal post.new?, false
  end

  def test_id
    post = Parse::Object.new "Post"
    assert_equal post.id, nil
    post["title"] = "hello world"
    post.save
    assert_equal post.id.class, String
  end

  def test_created_at
    post = Parse::Object.new "Post"
    assert_equal post.created_at, nil
    post.save
    assert_equal post.created_at.class, DateTime
  end

  def test_updated_at
    post = Parse::Object.new "Post"
    assert_equal post.updated_at, nil
    post["title"] = "hello"
    post.save
    assert_equal post.updated_at, nil
    post["title"] = "hello 2"
    post.save
    assert_equal post.updated_at.class, DateTime
  end

  def test_parse_delete
    post = Parse::Object.new "Post"
    post.save
    assert_equal post.id.class, String

    q = Parse.get("Post", post.id)
    assert_equal q.id, post.id

    post.parse_delete

    assert_raise Parse::ParseError do
      q = Parse.get("Post", post.id)
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
parse-ruby-client-0.0.7 test/test_object.rb
parse-ruby-client-0.0.6 test/test_object.rb
parse-ruby-client-0.0.5 test/test_object.rb
parse-ruby-client-0.0.4 test/test_object.rb