Sha256: c258dd9df88064f8a902ec1c8db94a2b934fddbbae67df9e56028e2d8881d102

Contents?: true

Size: 1.02 KB

Versions: 42

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe "Intercom::Tag" do
  let (:client) { Intercom::Client.new(app_id: 'app_id',  api_key: 'api_key') }

  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 "tags users" do
    client.expects(:post).with("/tags", {'name' => "Test Tag", 'users' => [ { user_id: 'abc123' }, { user_id: 'def456' } ], 'tag_or_untag' => 'tag'}).returns(test_tag)
    tag = client.tags.tag(:name => "Test Tag", :users => [ { user_id: "abc123" }, { user_id: "def456" } ] )
    tag.name.must_equal "Test Tag"
    tag.tagged_user_count.must_equal 2
  end

  it 'untags users' do
    client.expects(:post).with("/tags", {'name' => "Test Tag", 'users' => [ { user_id: 'abc123', untag: true }, { user_id: 'def456', untag: true } ], 'tag_or_untag' => 'untag'}).returns(test_tag)
    client.tags.untag(:name => "Test Tag", :users => [ { user_id: "abc123" }, { user_id: "def456" } ])
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
intercom-3.9.5 spec/unit/intercom/tag_spec.rb
intercom-3.9.4 spec/unit/intercom/tag_spec.rb
intercom-3.9.3 spec/unit/intercom/tag_spec.rb
intercom-3.9.2 spec/unit/intercom/tag_spec.rb
intercom-3.9.0 spec/unit/intercom/tag_spec.rb
intercom-3.8.1 spec/unit/intercom/tag_spec.rb
intercom-3.8.0 spec/unit/intercom/tag_spec.rb
intercom-3.7.7 spec/unit/intercom/tag_spec.rb
intercom-3.7.6 spec/unit/intercom/tag_spec.rb
intercom-3.7.5 spec/unit/intercom/tag_spec.rb
intercom-3.7.4 spec/unit/intercom/tag_spec.rb
intercom-3.7.3 spec/unit/intercom/tag_spec.rb
intercom-3.7.2 spec/unit/intercom/tag_spec.rb
intercom-3.7.1 spec/unit/intercom/tag_spec.rb
intercom-3.7.0 spec/unit/intercom/tag_spec.rb
intercom-3.6.2 spec/unit/intercom/tag_spec.rb
intercom-3.6.1 spec/unit/intercom/tag_spec.rb
intercom-3.6.0 spec/unit/intercom/tag_spec.rb
intercom-3.5.26 spec/unit/intercom/tag_spec.rb
intercom-3.5.25 spec/unit/intercom/tag_spec.rb