Feature: definitions version As a Responsible of definitions for a given document In order to detect handle versions definitions I want defmastership to export explicit versions in definitions Scenario: Extract one definition with explicit version to CSV Given a file named "thedoc.adoc" with: """ [define, requirement, TOTO-0001(pouet)] -- Exemple of multiline requirement. Second line. -- """ When I successfully run `defmastership export thedoc.adoc` Then the file "thedoc.csv" should contain: """ Type,Reference,Value,Checksum,Version requirement,TOTO-0001,"Exemple of multiline requirement. Second line.",~b86dcbde,pouet """ And the stdout should not contain anything And the stderr should not contain anything Scenario: Set initial explicit version when definition has changed Given a file named "ref_doc.adoc" with: """ [define, requirement, TOTO-0001] -- initial text. -- """ Given a file named "thedoc.adoc" with: """ [define, requirement, TOTO-0001(whatever)] -- modified text. -- """ And a file named "modifications.yml" with: """ --- :update_requirement_version: :type: update_def_version :config: :def_type: requirement :first_version: a :ref_document: ./ref_doc.adoc """ When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc` And the stdout should not contain anything And the stderr should not contain anything Then the file "thedoc.adoc" should contain: """ [define, requirement, TOTO-0001(a)] -- modified text. -- """ Scenario: Do not set initial explicit version when definition has NOT changed Given a file named "ref_doc.adoc" with: """ [define, requirement, TOTO-0001] -- initial text. -- """ Given a file named "thedoc.adoc" with: """ [define, requirement, TOTO-0001(whatever)] -- initial text. -- """ And a file named "modifications.yml" with: """ --- :update_requirement_version: :type: update_def_version :config: :def_type: requirement :first_version: a :ref_document: ./ref_doc.adoc """ When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc` And the stdout should not contain anything And the stderr should not contain anything Then the file "thedoc.adoc" should contain: """ [define, requirement, TOTO-0001] -- initial text. -- """ Scenario: Set initial explicit version when definition has changed and ref is not an initial version Given a file named "ref_doc.adoc" with: """ [define, requirement, TOTO-0001(3)] -- initial text. -- """ Given a file named "thedoc.adoc" with: """ [define, requirement, TOTO-0001(whatever)] -- modified text. -- """ And a file named "modifications.yml" with: """ --- :update_requirement_version: :type: update_def_version :config: :def_type: requirement :first_version: 1 :ref_document: ./ref_doc.adoc """ When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc` And the stdout should not contain anything And the stderr should not contain anything Then the file "thedoc.adoc" should contain: """ [define, requirement, TOTO-0001(4)] -- modified text. -- """ Scenario: No initial explicit version when definition is new Given a file named "ref_doc.adoc" with: """ [define, requirement, TOTO-0002] -- initial text. -- """ Given a file named "thedoc.adoc" with: """ [define, requirement, TOTO-0001(whatever)] -- modified text. -- """ And a file named "modifications.yml" with: """ --- :update_requirement_version: :type: update_def_version :config: :def_type: requirement :first_version: 1 :ref_document: ./ref_doc.adoc """ When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc` And the stdout should not contain anything And the stderr should not contain anything Then the file "thedoc.adoc" should contain: """ [define, requirement, TOTO-0001] -- modified text. -- """ Scenario: update explicit version whith explicit checksum Given a file named "ref_doc.adoc" with: """ [define, requirement, TOTO-0001] -- initial text. -- """ Given a file named "thedoc.adoc" with: """ [define, requirement, TOTO-0001(whatever~abcd1234)] -- modified text. -- """ And a file named "modifications.yml" with: """ --- :update_requirement_version: :type: update_def_version :config: :def_type: requirement :first_version: a :ref_document: ./ref_doc.adoc """ When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc` And the stdout should not contain anything And the stderr should not contain anything Then the file "thedoc.adoc" should contain: """ [define, requirement, TOTO-0001(a~abcd1234)] -- modified text. -- """