Sha256: faaa2a7ec73153a53b380a6ca9b34569089ba3922a648e31fd638033210f6fbf

Contents?: true

Size: 1.28 KB

Versions: 22

Compression:

Stored size: 1.28 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, { :comment => { :value => 'This is solved!' } }
  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

22 entries across 22 versions & 1 rubygems

Version Path
zendesk_api-1.13.1 spec/live/request_spec.rb
zendesk_api-1.12.1 spec/live/request_spec.rb
zendesk_api-1.12.0 spec/live/request_spec.rb
zendesk_api-1.11.7 spec/live/request_spec.rb
zendesk_api-1.11.6 spec/live/request_spec.rb
zendesk_api-1.11.5 spec/live/request_spec.rb
zendesk_api-1.11.4 spec/live/request_spec.rb
zendesk_api-1.11.3 spec/live/request_spec.rb
zendesk_api-1.11.2 spec/live/request_spec.rb
zendesk_api-1.11.1 spec/live/request_spec.rb
zendesk_api-1.11.0 spec/live/request_spec.rb
zendesk_api-1.10.0 spec/live/request_spec.rb
zendesk_api-1.9.6 spec/live/request_spec.rb
zendesk_api-1.9.5 spec/live/request_spec.rb
zendesk_api-1.9.4 spec/live/request_spec.rb
zendesk_api-1.9.3 spec/live/request_spec.rb
zendesk_api-1.9.2 spec/live/request_spec.rb
zendesk_api-1.9.1 spec/live/request_spec.rb
zendesk_api-1.9.0 spec/live/request_spec.rb
zendesk_api-1.8.0 spec/live/request_spec.rb