Sha256: 3d404af7db01734f0341efe0f76d3ec441bfaf4757c12b400750deaec38d65c5

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
parse_resource-1.8.0 test/test_parse_installation.rb