test/story_test.rb in tracker_api-0.2.12 vs test/story_test.rb in tracker_api-1.0.0

- old
+ new

@@ -17,10 +17,11 @@ VCR.use_cassette('save story', record: :new_episodes) do story.save end story.name.must_equal new_name + story.clean?.must_equal true end it 'can update multiple attributes of an existing story at once' do new_name = "#{story.name}+" new_desc = "#{story.description}+" @@ -34,22 +35,28 @@ story.name.must_equal new_name story.description.must_equal new_desc end it 'can add new labels to an existing story' do - new_label_name = 'super-special-label' + new_label_name = "super-special-label" story.labels.map(&:name).wont_include new_label_name - new_label = TrackerApi::Resources::Label.new(name: new_label_name) - story.labels << new_label + story.add_label(new_label_name) VCR.use_cassette('save story with new label', record: :new_episodes) do story.save end story.labels.wont_be_empty story.labels.map(&:name).must_include new_label_name + 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"}) + + expected_json.must_equal story_with_one_change.to_json end it 'objects are equal based on id' do story_a = story story_b = VCR.use_cassette('get story') { project.story(story_id) }