Sha256: 015cd9710c0e8fd056acfe95b17aa075f71f68c60b4c6f0ffeac65a19c0a1c2c

Contents?: true

Size: 1.23 KB

Versions: 18

Compression:

Stored size: 1.23 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 "shouldn't re-save destroyed tags" do
        parent.tags.first.destroy!
        parent.tags.save!

        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

18 entries across 18 versions & 1 rubygems

Version Path
zendesk_api-1.3.9 spec/live/tag_spec.rb
zendesk_api-1.3.8 spec/live/tag_spec.rb
zendesk_api-1.3.7 spec/live/tag_spec.rb
zendesk_api-1.2.10 spec/live/tag_spec.rb
zendesk_api-1.2.9 spec/live/tag_spec.rb
zendesk_api-1.2.8 spec/live/tag_spec.rb
zendesk_api-1.3.5 spec/live/tag_spec.rb
zendesk_api-1.2.7 spec/live/tag_spec.rb
zendesk_api-1.3.4 spec/live/tag_spec.rb
zendesk_api-1.3.2 spec/live/tag_spec.rb
zendesk_api-1.3.1 spec/live/tag_spec.rb
zendesk_api-1.3.0 spec/live/tag_spec.rb
zendesk_api-1.3.0.rc3 spec/live/tag_spec.rb
zendesk_api-1.2.6 spec/live/tag_spec.rb
zendesk_api-1.3.0.rc2 spec/live/tag_spec.rb
zendesk_api-1.3.0.rc1 spec/live/tag_spec.rb
zendesk_api-1.2.5 spec/live/tag_spec.rb
zendesk_api-1.2.4 spec/live/tag_spec.rb