Sha256: 2c0b7949216de11a6329dc200fdf38d51ea234af353ddf517cbab957e9a7de6e

Contents?: true

Size: 976 Bytes

Versions: 6

Compression:

Stored size: 976 Bytes

Contents

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

Version data entries

6 entries across 6 versions & 1 rubygems

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