Skip to content

Commit 4184833

Browse files
committed
Made story title prefix customisable.
1 parent 6fb64e3 commit 4184833

12 files changed

Lines changed: 82 additions & 80 deletions

TestStack.BDDfy.Tests/Reporters/Html/HtmlReportBuilderTests.ShouldProduceExpectedHtml.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ body{max-width:100%;background-color:#fff;font-family:Verdana,Arial,Helvetica,sa
7070
<li>
7171
<div class='story NotExecuted'>
7272
<div class='storyMetadata'>
73-
<div class='storyTitle'>Account holder withdraws cash</div>
73+
<div class='storyTitle'>Story: Account holder withdraws cash</div>
7474
<ul class='storyNarrative'>
7575
<li>As an account holder</li>
7676
<li>I want to withdraw cash</li>
@@ -112,7 +112,7 @@ body{max-width:100%;background-color:#fff;font-family:Verdana,Arial,Helvetica,sa
112112
<li>
113113
<div class='story NotExecuted'>
114114
<div class='storyMetadata'>
115-
<div class='storyTitle'>Happiness</div>
115+
<div class='storyTitle'>Story: Happiness</div>
116116
<ul class='storyNarrative'>
117117
<li>As a person</li>
118118
<li>I want ice cream</li>

TestStack.BDDfy.Tests/Reporters/HtmlMetro/HtmlMetroReportBuilderTests.ShouldProduceExpectedHtml.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<li>
8888
<div class='story Failed'>
8989
<div class='storyMetaData'>
90-
<h3 class='storyTitle'>Account holder withdraws cash</h3>
90+
<h3 class='storyTitle'>Story: Account holder withdraws cash</h3>
9191
<ul class='storyNarrative'>
9292
<li>As an account holder</li>
9393
<li>I want to withdraw cash</li>
@@ -157,7 +157,7 @@
157157
<li>
158158
<div class='story Failed'>
159159
<div class='storyMetaData'>
160-
<h3 class='storyTitle'>Happiness</h3>
160+
<h3 class='storyTitle'>Story: Happiness</h3>
161161
<ul class='storyNarrative'>
162162
<li>As a person</li>
163163
<li>I want ice cream</li>

TestStack.BDDfy.Tests/Stories/StoryClassBase.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ namespace TestStack.BDDfy.Tests.Stories
22
{
33
[Story(
44
Title = StoryTitle,
5+
TitlePrefix = StoryTitlePrefix,
56
AsA = "As a programmer",
67
IWant = "I want BDDfy to inherit StoryAttribute",
78
SoThat = "So that I can put some shared logic on a base story class")]
89
public abstract class StoryClassBase
910
{
1011
protected const string StoryTitle = "Story base class";
12+
protected const string StoryTitlePrefix = "Specifications: ";
1113

1214
protected void GivenTheStoryAttributeIsSetOnTheBaseClass()
1315
{

TestStack.BDDfy.Tests/Stories/StorySubclass.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public void Verify()
1212
_story = this.BDDfy();
1313
Assert.That(_story.Metadata, Is.Not.Null);
1414
Assert.That(_story.Metadata.Title, Is.EqualTo(StoryTitle));
15+
Assert.That(_story.Metadata.TitlePrefix, Is.EqualTo(StoryTitlePrefix));
1516
}
1617

1718
void WhenTheSubclassIsBddified()

TestStack.BDDfy/Reporters/ConsoleReporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private static void ReportStoryHeader(Story story)
3737
if (story.Metadata == null || story.Metadata.Type == null)
3838
return;
3939

40-
Console.WriteLine("Story: " + story.Metadata.Title);
40+
Console.WriteLine(story.Metadata.TitlePrefix + story.Metadata.Title);
4141
if (!string.IsNullOrEmpty(story.Metadata.Narrative1))
4242
Console.WriteLine("\t" + story.Metadata.Narrative1);
4343
if (!string.IsNullOrEmpty(story.Metadata.Narrative2))

TestStack.BDDfy/Reporters/Html/BDDfy.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,6 @@ div.story {
209209
border-radius: 10px;
210210
}
211211

212-
.storyTitle:before {
213-
content: "Story: ";
214-
}
215-
216212
.storyTitle {
217213
display: inline;
218214
}

TestStack.BDDfy/Reporters/Html/HtmlReportBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ private void AddStoryMetadataAndNarrative(Story story)
226226
}
227227
else
228228
{
229-
AddLine(string.Format("<div class='storyTitle'>{0}</div>", story.Metadata.Title));
229+
AddLine(string.Format("<div class='storyTitle'>{0}{1}</div>", story.Metadata.TitlePrefix, story.Metadata.Title));
230230
}
231231

232232
if (story.Metadata != null && !string.IsNullOrEmpty(story.Metadata.Narrative1))

TestStack.BDDfy/Reporters/HtmlMetro/MetroHtmlReportTemplate.cs

Lines changed: 65 additions & 65 deletions
Large diffs are not rendered by default.

TestStack.BDDfy/Reporters/HtmlMetro/MetroHtmlReportTemplate.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
<# }
102102
else
103103
{ #>
104-
<h3 class='storyTitle'><#= story.Metadata.Title #></h3>
104+
<h3 class='storyTitle'><#= story.Metadata.TitlePrefix + story.Metadata.Title #></h3>
105105
<# } #>
106106
<# if (story.Metadata != null && !string.IsNullOrEmpty(story.Metadata.Narrative1))
107107
{ #>

TestStack.BDDfy/Reporters/MarkDown/MarkDownReportBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public string CreateReport(FileReportModel model)
1212
{
1313
if (story.Metadata != null)
1414
{
15-
report.AppendLine(string.Format("## Story: {0}", story.Metadata.Title));
15+
report.AppendLine(string.Format("## {0}{1}", story.Metadata.TitlePrefix, story.Metadata.Title));
1616
if (!string.IsNullOrEmpty(story.Metadata.Narrative1))
1717
report.AppendLine(string.Format(" **{0}** ", story.Metadata.Narrative1));
1818
if (!string.IsNullOrEmpty(story.Metadata.Narrative2))

0 commit comments

Comments
 (0)