 	@test.assertTruthy ID, 'ID is stored in localStorage'
 
 casper.then ->
+	ID = @evaluate ->
+		new window.AnonKissmetricsClient 'abc123', {storageKey: 'customKey'}
+		window.localStorage.getItem 'customKey'
+
+	@test.assertTruthy ID, 'ID is stored in localStorage with custom storage key'
+
+casper.then ->
 	data = @evaluate ->
 		km = new window.AnonKissmetricsClient 'abc123', {storage: 'cookie'}
 		{cookies: document.cookie, person: km.person}

		km.person

	@test.assertEquals originalPerson, newPerson, 'Person is persistent in localStorage'


# Record

	@test.assertTruthy data.cookies.match matchString, 'Cookie is saved'

casper.then ->
	data = @evaluate ->
		km = new window.AnonKissmetricsClient 'abc123',
			storage: 'cookie'
			storageKey: 'somethingCustom'
		{cookies: document.cookie, person: km.person}

	matchString = "somethingCustom=#{data.person}"
	@test.assertTruthy data.cookies.match matchString, 'Cookie is saved with custom storage key'

casper.then ->
	originalPerson = @evaluate ->
		km = new window.AnonKissmetricsClient 'abc123', {storage: 'cookie'}
		km.person
