Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (30 sloc) 0.976 kb
require 'helper'
Parse.init
class TestQuery < Test::Unit::TestCase
def test_get
post = Parse::Object.new "Post"
post["title"] = "foo"
post.save
q = Parse.get("Post", post.id)
assert_equal q.id, post.id
assert_equal q["title"], post["title"]
end
def test_add_contraint
# I know this method *should* be private.
# But then it would be a PITA to test.
# I'd rather test this one method than pointlessly test many others.
# Thus is life.
q = Parse::Query.new "TestQuery"
q.add_constraint("points", 5)
assert_equal q.where["points"], 5
q.add_constraint("player", { "$regex" => "regex voodoo"})
assert_equal q.where["player"], { "$regex" => "regex voodoo"}
end
def test_eq
q = Parse::Query.new "TestQuery"
q.eq("points", 5)
assert_equal q.where, {"points" => 5}
q.eq("player", "michael@jordan.com")
assert_equal q.where, {"points" => 5, "player" => "michael@jordan.com"}
end
end
Jump to Line
Something went wrong with that request. Please try again.