spec/identity_spec.rb in tokyo_api-1.0.2 vs spec/identity_spec.rb in tokyo_api-1.0.4
- old
+ new
@@ -52,6 +52,28 @@
it 'should url-escape field names with weird characters' do
expect(subject.identity.tokyo_identity_user_path('-123456', required_fields: ['email', 'fish & chips'])).to eq('/identity/user/-123456?required_fields=email,fish+%26+chips')
end
end
end
+
+ describe '#subscription_status_path' do
+ it 'should raise if neither param provided' do
+ expect { subject.identity.subscription_status_path('abc123') }.to raise_error(RuntimeError)
+ end
+
+ it 'should return correct path for a list of public ids' do
+ expected_path = '/identity/subscription_status/abc123?opt_in_public_ids=policy-1.5%2Cpolicy-1.6'
+ expect(subject.identity.subscription_status_path('abc123', opt_in_public_ids: ['policy-1.5', 'policy-1.6'])).to eq expected_path
+ end
+
+
+ it 'should return correct path for a specific external id' do
+ expected_path = '/identity/subscription_status/abc123?opt_in_external_id=policy-1.5'
+ expect(subject.identity.subscription_status_path('abc123', opt_in_external_id: 'policy-1.5')).to eq expected_path
+ end
+
+ it 'should support minimum_consent_level' do
+ expected_path = '/identity/subscription_status/abc123?opt_in_external_id=policy-1.5&minimum_consent_level=explicit'
+ expect(subject.identity.subscription_status_path('abc123', opt_in_external_id: 'policy-1.5', minimum_consent_level: 'explicit')).to eq expected_path
+ end
+ end
end