Sha256: 0b7ec1ee0144a08e258d5ee09fd3772f1b1f0b90b2f8901afdf81743fc640dfa

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require 'core/spec_helper'

describe ZendeskAPI::Topic do
  def valid_attributes
    {
      :forum_id => forum.id, :title => "My Topic",
      :body => "The mayan calendar ends December 31st. Coincidence? I think not."
    }
  end

  it_should_be_creatable
  it_should_be_updatable :title
  it_should_be_deletable :create => true
  it_should_be_readable :topics
  it_should_be_readable current_user, :topics
  it_should_be_readable forum, :topics
  #it_should_be_readable :topics, :show_many, :verb => :post, :ids =>

  describe ".import" do
    it "can import" do
      VCR.use_cassette("topic_import_can_import") do
        old = Time.now - 5*365*24*60*60
        topic = ZendeskAPI::Topic.import(client, valid_attributes.merge(:created_at => old))
        expect(ZendeskAPI::Topic.find(client, topic).created_at.year).to eq(old.year)
      end
    end

    it "returns nothing if import fails" do
      VCR.use_cassette("topic_import_cannot_import") do
        silence_logger { expect(ZendeskAPI::Topic.import(client, {})).to eq(nil) }
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zendesk_api-1.4.5 spec/live/topic_spec.rb
zendesk_api-1.4.4 spec/live/topic_spec.rb
zendesk_api-1.4.3 spec/live/topic_spec.rb
zendesk_api-1.4.2 spec/live/topic_spec.rb
zendesk_api-1.4.0 spec/live/topic_spec.rb