test/story_test.rb in tracker_api-1.7.0 vs test/story_test.rb in tracker_api-1.7.1
- old
+ new
@@ -7,10 +7,11 @@
let(:pt_user_2_id) { pt_user_2[:id] }
let(:client) { TrackerApi::Client.new token: pt_user_1[:token] }
let(:project_id) { pt_user_1[:project_id] }
let(:project) { VCR.use_cassette('get project') { client.project(project_id) } }
let(:story_id) { '66728004' }
+ let(:story_in_epic_id) { '66728030' }
let(:another_story_id) { '66728000' }
let(:story_id_no_existing_labels) { '82330712' }
let(:story) { VCR.use_cassette('get story') { project.story(story_id) } }
it 'can update an existing story' do
@@ -65,9 +66,33 @@
story.save
end
story.labels.wont_be_empty
story.labels.map(&:name).must_include new_label_name
+ end
+
+ it 'does not remove existing labels when updating story fields' do
+ story_in_epic = nil
+ VCR.use_cassette('get story in epic') do
+ story_in_epic = project.story(story_in_epic_id)
+ end
+
+ original_labels = story_in_epic.labels
+ original_label_list = story_in_epic.label_list
+
+ VCR.use_cassette('create story comment', record: :new_episodes) do
+ story_in_epic.create_comment text: "This is a test comment."
+ end
+
+ story_in_epic.estimate = 2
+ story_in_epic.current_state = 'started'
+
+ VCR.use_cassette('save story in epic', record: :new_episodes) do
+ story_in_epic.save
+ end
+
+ story_in_epic.labels.must_equal original_labels
+ story_in_epic.label_list.must_equal original_label_list
end
it 'does not send unmodified fields when saving' do
story_with_one_change = TrackerApi::Resources::Story::UpdateRepresenter.new(TrackerApi::Resources::Story.new(name: "new_name"))
expected_json = MultiJson.dump({name: "new_name"})