spec/live/request_spec.rb in zendesk_api-1.4.3 vs spec/live/request_spec.rb in zendesk_api-1.4.4
- old
+ new
@@ -10,6 +10,29 @@
it_should_be_creatable
it_should_be_updatable :subject
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