Sha256: d1401128b3616acf336bbb46fd011609de6d2de17ccf14717be3952d0c7164c5

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

require 'core/spec_helper'

describe ZendeskAPI::Request do
  def valid_attributes
    {
      :subject => "This is a question!",
      :comment => { :value => "Haha, no." }
    }
  end

  it_should_be_creatable
  it_should_be_updatable :solved, true
  it_should_be_readable :requests
  it_should_be_readable user, :requests

  it "can upload while creating" do
    VCR.use_cassette("request_inline_uploads") do
      request = ZendeskAPI::Request.new(client, valid_attributes)
      request.comment.uploads << "spec/fixtures/Argentina.gif"
      request.comment.uploads << File.new("spec/fixtures/Argentina.gif")

      request.save!
      expect(request.changes).to eq({}) # uploads were set before save
      expect(request.comment.attributes[:uploads].map(&:class)).to eq([String, String]) # upload was sent as tokens
    end
  end

  it "can comment while creating" do
    VCR.use_cassette("request_inline_comments") do
      request = ZendeskAPI::Request.new(client, valid_attributes)
      request.comment = ZendeskAPI::Request::Comment.new(client, :value => "My comment")
      request.save!

      expect(request.changes).to eq({}) # comment was set before save
      expect(request.attributes[:comment]).to eq({"value" => "My comment"})
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zendesk_api-1.7.1 spec/live/request_spec.rb
zendesk_api-1.7.0 spec/live/request_spec.rb
zendesk_api-1.6.3 spec/live/request_spec.rb
zendesk_api-1.6.2 spec/live/request_spec.rb
zendesk_api-1.6.1 spec/live/request_spec.rb
zendesk_api-1.6.0 spec/live/request_spec.rb