Sha256: 608b1c81dd85d1b541761a8108431ed320ceef55a78b65e5f90cf2f5d3aeecb9
Contents?: true
Size: 1.26 KB
Versions: 6
Compression:
Stored size: 1.26 KB
Contents
# frozen_string_literal: true require 'spec_helper' describe 'Intercom::Tag' do let(:client) { Intercom::Client.new(token: 'token') } it 'creates a tag' do client.expects(:post).with('/tags', 'name' => 'Test Tag').returns(test_tag) tag = client.tags.create(name: 'Test Tag') _(tag.name).must_equal 'Test Tag' end it 'finds a tag by id' do client.expects(:get).with('/tags/4f73428b5e4dfc000b000112', {}).returns(test_tag) tag = client.tags.find(id: '4f73428b5e4dfc000b000112') _(tag.name).must_equal 'Test Tag' end it 'tags companies' do client.expects(:post).with('/tags', 'name' => 'Test Tag', 'companies' => [{ company_id: 'abc123' }, { company_id: 'def456' }], 'tag_or_untag' => 'tag').returns(test_tag) tag = client.tags.tag(name: 'Test Tag', companies: [{ company_id: 'abc123' }, { company_id: 'def456' }]) _(tag.name).must_equal 'Test Tag' _(tag.tagged_company_count).must_equal 2 end it 'untags companies' do client.expects(:post).with('/tags', 'name' => 'Test Tag', 'companies' => [{ company_id: 'abc123', untag: true }, { company_id: 'def456', untag: true }], 'tag_or_untag' => 'untag').returns(test_tag) client.tags.untag(name: 'Test Tag', companies: [{ company_id: 'abc123' }, { company_id: 'def456' }]) end end
Version data entries
6 entries across 6 versions & 1 rubygems