Sha256: 09ac5c53c62751eefa79623e77210da54bf14b946b9e9a65d6e45087f0f4d310

Contents?: true

Size: 1.08 KB

Versions: 16

Compression:

Stored size: 1.08 KB

Contents

require 'core/spec_helper'

describe ZendeskAPI::Tag, :vcr, :not_findable do
  it_should_be_readable :tags

  [organization, topic, ticket].each do |object|
    under object do
      before(:each) do
        parent.tags = %w{tag2 tag3}
        parent.tags.save!
      end

      it "can be set" do
        tags.should == %w{tag2 tag3}
      end

      it "should be removable" do
        parent.tags.destroy!(:id => "tag2")

        tags.should == %w{tag3}
      end

      it "should be updatable" do
        parent.tags.update!(:id => "tag4")

        tags.should == %w{tag2 tag3 tag4}
      end

      it "should be savable" do
        parent.tags << "tag4"
        parent.tags.save!

        tags.should == %w{tag2 tag3 tag4}
      end

      it "should be modifiable" do
        parent.tags.delete(ZendeskAPI::Tag.new(nil, :id => "tag2"))
        parent.tags.save!

        tags.should == %w{tag3}

        parent.tags.delete_if {|tag| tag.id == "tag3"}
        parent.tags.save!

        tags.should be_empty
      end
    end
  end

  def tags
    parent.tags.fetch!(:reload).map(&:id).sort
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
zendesk_api-1.2.3 spec/live/tag_spec.rb
zendesk_api-1.2.2 spec/live/tag_spec.rb
zendesk_api-1.2.1 spec/live/tag_spec.rb
zendesk_api-1.1.3 spec/live/tag_spec.rb
zendesk_api-1.1.2 spec/live/tag_spec.rb
zendesk_api-1.1.1 spec/live/tag_spec.rb
zendesk_api-1.1.0 spec/live/tag_spec.rb
zendesk_api-1.0.7 spec/live/tag_spec.rb
zendesk_api-1.0.6 spec/live/tag_spec.rb
zendesk_api-1.0.5 spec/live/tag_spec.rb
zendesk_api-1.0.4 spec/live/tag_spec.rb
zendesk_api-1.0.3 spec/live/tag_spec.rb
zendesk_api-1.0.2 spec/live/tag_spec.rb
zendesk_api-1.0.1 spec/live/tag_spec.rb
zendesk_api-1.0.0 spec/live/tag_spec.rb
zendesk_api-0.4.0.rc3 spec/live/tag_spec.rb