spec/unit/intercom/contact_spec.rb in intercom-4.1.1 vs spec/unit/intercom/contact_spec.rb in intercom-4.1.2
- old
+ new
@@ -246,10 +246,22 @@
contact = Intercom::Contact.new('id' => '1')
client.expects(:delete).with('/contacts/1', {}).returns(contact)
client.contacts.delete(contact)
end
+ it 'archives a contact' do
+ contact = Intercom::Contact.new('id' => '1')
+ client.expects(:post).with('/contacts/1/archive', {})
+ client.contacts.archive(contact)
+ end
+
+ it 'unarchives a contact' do
+ contact = Intercom::Contact.new('id' => '1')
+ client.expects(:post).with('/contacts/1/unarchive', {})
+ client.contacts.unarchive(contact)
+ end
+
describe 'merging' do
let(:lead) { Intercom::Contact.from_api(external_id: 'contact_id', role: 'lead') }
let(:user) { Intercom::Contact.from_api(id: 'external_id', role: 'user') }
it 'should be successful with a lead and user' do
@@ -269,9 +281,16 @@
it 'returns a collection proxy for listing notes' do
proxy = contact.notes
_(proxy.resource_name).must_equal 'notes'
_(proxy.url).must_equal '/contacts/1/notes'
_(proxy.resource_class).must_equal Intercom::Note
+ end
+
+ it 'returns a collection proxy for listing segments' do
+ proxy = contact.segments
+ _(proxy.resource_name).must_equal 'segments'
+ _(proxy.url).must_equal '/contacts/1/segments'
+ _(proxy.resource_class).must_equal Intercom::Segment
end
it 'returns a collection proxy for listing tags' do
proxy = contact.tags
_(proxy.resource_name).must_equal 'tags'