-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathtest_parse_installation.rb
41 lines (33 loc) · 1.25 KB
/
test_parse_installation.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require 'helper'
require 'parse_resource'
ParseResource::Base.load!(ENV["PARSE_RESOURCE_APPLICATION_ID"], ENV["PARSE_RESOURCE_MASTER_KEY"])
class Installation < ParseResource::Base
end
class TestParseUser < Test::Unit::TestCase
#def setup
# User.destroy_all
#end
#def teardown
# User.destroy_all
#end
def test_installation_creation
VCR.use_cassette('test_installation_creation', :record => :new_episodes) do
Installation.destroy_all
i = Installation.create(:deviceType => "ios",
:deviceToken => "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
:channels => [""])
assert_not_nil(i.id)
assert i.errors.empty?
end
end
def test_installation_creation_validation_check
VCR.use_cassette('test_installation_creation_validation_check', :record => :new_episodes) do
Installation.destroy_all
# missing deviceType
i = Installation.create(:deviceToken => "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
:channels => [""])
assert_equal false, i.errors.empty?
assert_equal "135".to_sym, i.errors.first.first # deviceType must be specified in this operation
end
end
end