Sha256: 61997437b3d100481e97145d3de2d5ef72b4b7d1a99f7133d24a245ba9ce8b71

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require_relative 'minitest_helper'

describe TrackerApi::Resources::Comment 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) } }
  let(:comments) { VCR.use_cassette('get comments') { story.comments } }
  let(:existing_comment) { comments.first }

  it 'can create a comment given a story' do
    text = "Test creating a comment"
    comment = nil
    VCR.use_cassette('create comment', record: :new_episodes) do
      comment = story.create_comment(text: text)
    end

    comment.text.must_equal text
    comment.clean?.must_equal true
  end

  it 'can update an existing comment' do
    new_text = "#{existing_comment.text}+"
    existing_comment.text = new_text

    VCR.use_cassette('save comment', record: :new_episodes) do
      existing_comment.save
    end

    existing_comment.text.must_equal new_text
    existing_comment.clean?.must_equal true
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tracker_api-1.7.1 test/comment_test.rb
tracker_api-1.7.0 test/comment_test.rb
tracker_api-1.6.0 test/comment_test.rb
tracker_api-1.5.0 test/comment_test.rb