Sha256: 94974d396482d23b3e7b5d7ee1ef738d5d0380b85dcc3fe55a030a01aaa97b24

Contents?: true

Size: 878 Bytes

Versions: 2

Compression:

Stored size: 878 Bytes

Contents

require_relative 'minitest_helper'

describe TrackerApi::Resources::FileAttachment do
  let(:pt_user) { PT_USER_1 }
  let(:client) { TrackerApi::Client.new token: pt_user[:token] }
  let(:project_id) { pt_user[:project_id] }
  let(:project) { VCR.use_cassette('get project') { client.project(project_id) } }
  let(:story_id) { '66728004' }
  let(:story) { VCR.use_cassette('get story') { project.story(story_id) } }

  it 'can be deleted' do
    VCR.use_cassette('delete an attachment', record: :new_episodes) do
      comment_with_attachments = story.create_comment(text: "test comment", files: [File.expand_path('../Gemfile', File.dirname(__FILE__))])
      comment_with_attachments.attachments(reload: true).size.must_equal 1
      comment_with_attachments.attachments.first.delete
      comment_with_attachments.attachments(reload: true).size.must_equal 0
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tracker_api-1.9.1 test/file_attachment_test.rb
tracker_api-1.9.0 test/file_attachment_test.rb