-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
80 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,32 @@ | ||
require 'helper' | ||
|
||
class TestClient < Test::Unit::TestCase | ||
should "probably rename this file and start testing for real" do | ||
flunk "hey buddy, you should probably rename this file and start testing for real" | ||
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 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'helper' | ||
|
||
#Parse.init :application_id => $PARSE_APPLICATION_ID, :api_key => $PARSE_REST_API_KEY | ||
|
||
class TestInit < Test::Unit::TestCase | ||
def setup | ||
Parse.destroy | ||
end | ||
|
||
def test_no_api_keys_error | ||
fake = Parse::Object.new "shouldNeverExist" | ||
fake["foo"] = "bar" | ||
|
||
begin | ||
fake.save | ||
rescue | ||
error_triggered = true | ||
end | ||
|
||
assert_equal error_triggered, true | ||
assert_equal fake[Parse::Protocol::KEY_OBJECT_ID], nil | ||
end | ||
end |