Skip to content

Commit

Permalink
Updated tests and cleaned up the code
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-molak committed Feb 2, 2024
1 parent 7fbc06f commit efcee55
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class WhenAssociatingATestOutcomeWithARequirementInAFeatureFile extends Specific
def testOutcome = TestOutcome.forTestInStory("someTest", Story.withIdAndPath("PlantPotatoes","Plant potatoes","grow_potatoes/grow_new_potatoes/PlantPotatoes.story"))
then:
capabilityProvider.getParentRequirementOf(testOutcome).isPresent()
capabilityProvider.getParentRequirementOf(testOutcome).get().name == "Plant Potatoes"
capabilityProvider.getParentRequirementOf(testOutcome).get().name == "PlantPotatoes"
capabilityProvider.getParentRequirementOf(testOutcome).get().displayName == "Plant Potatoes"
}

def "Should not find the requirement if there are no matching requirements for a tag"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class WhenGeneratingRequirementsReportData extends Specification {
RequirementsOutcomes outcomes = requirmentsOutcomeFactory.buildRequirementsOutcomesFrom(noTestOutcomes)
then: "all the known capabilities should be listed"
def requirementsNames = outcomes.requirementOutcomes.collect {it.requirement.name}
requirementsNames == ["grow cucumbers", "Grow potatoes", "Grow wheat", "raise_chickens", "Apples", "Nice zucchinis", "Potatoes"]
requirementsNames == ["grow cucumbers", "grow_potatoes", "grow_wheat", "raise_chickens", "Apples", "Nice zucchinis", "Potatoes"]
and: "the display name should be obtained from the narrative file where present"
def requirementsDisplayNames = outcomes.requirementOutcomes.collect {it.requirement.displayName}
requirementsDisplayNames == ["Grow cucumbers", "Grow potatoes", "Grow wheat", "Raise chickens", "Apples", "Nice zucchinis", "Potatoes title"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ class WhenLoadingRequirementOutcomesFromTheFileSystem extends Specification {
capabilityNames == ["Grow cucumbers", "Grow potatoes", "Grow wheat", "Raise chickens"]
and: "the child requirements should be found"
def growCucumbers = capabilities.get(0)
def cucumberFeatures = growCucumbers.children.collect { it.name }
cucumberFeatures == ["Grow green cucumbers"]

def cucumberFeatureNames = growCucumbers.children.collect { it.name }
cucumberFeatureNames == ["grow green cucumbers"]
}

def "Should be able to load issues from the default directory structure"() {
Expand All @@ -78,7 +79,8 @@ class WhenLoadingRequirementOutcomesFromTheFileSystem extends Specification {
then: "the capability should be found"
def potatoeGrowingCapability = capabilities.get(1)
then: "the title should be a human-readable version of the directory name"
potatoeGrowingCapability.name == "Grow potatoes"
potatoeGrowingCapability.name == "grow_potatoes"
potatoeGrowingCapability.displayName == "Grow potatoes"
}

def "Should support feature files in the requirements directory"() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Grow potatoes

Narrative:
In order to let my country eat chips
As a farmer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,6 @@ private Requirement storyNamed(String storyName, String displayName, String path
}

private Requirement leafRequirementWithNarrative(String requirementName, String displayName, String path, RequirementDefinition requirementNarrative) {
// String displayName = getTitleFromNarrativeOrDirectoryName(requirementNarrative, requirementName);
String cardNumber = requirementNarrative.getCardNumber().orElse(null);
String type = requirementNarrative.getType();
List<String> releaseVersions = requirementNarrative.getVersionNumbers();
Expand Down

0 comments on commit efcee55

Please sign in to comment.