Skip to content
Browse files

Fixing a bug where result supplements would get deleted if more than …

…one supplement is created during a run
  • Loading branch information...
1 parent 39809af commit 3f4a96153ae0a45c4950938557936176edb0a34d @agross agross committed Jan 27, 2012
View
6 .../Machine.Specifications.Reporting.Specs/Generation/Spark/SparkHtmlReportGeneratorSpecs.cs
@@ -89,7 +89,7 @@ public class when_reporting_to_a_file
Because of = () => Generator.GenerateReport(Run);
It should_create_a_directory_for_the_report_resources =
- () => FileSystem.AssertWasCalled(x => x.CreateOrOverwriteDirectory(ResourceDirectory));
+ () => FileSystem.AssertWasCalled(x => x.EnsureDirectoryExists(ResourceDirectory), o => o.Repeat.Once());
It should_overwrite_existing_reports =
() => FileSystem.AssertWasCalled(x => x.DeleteIfFileExists(Arg<string>.Is.Anything));
@@ -158,7 +158,7 @@ public class when_reporting_to_a_directory
Because of = () => Generator.GenerateReport(Run);
It should_create_a_directory_for_the_report_resources =
- () => FileSystem.AssertWasCalled(x => x.CreateOrOverwriteDirectory(ResourceDirectory));
+ () => FileSystem.AssertWasCalled(x => x.EnsureDirectoryExists(ResourceDirectory));
It should_overwrite_existing_reports_and_summaries =
() => FileSystem.AssertWasCalled(x => x.DeleteIfFileExists(Arg<string>.Is.Anything),
@@ -289,7 +289,7 @@ public class when_rendering_reports_with_enriched_metadata_to_a_directory
Establish context = () =>
{
- ReportPath = @"C:\path\to\the\report.html";
+ ReportPath = @"C:\path\to\the\report";
FileSystem = MockRepository.GenerateStub<IFileSystem>();
FileSystem
View
6 Source/Machine.Specifications.Reporting/FileSystem.cs
@@ -6,7 +6,7 @@ namespace Machine.Specifications.Reporting
public interface IFileSystem
{
bool IsValidPathToDirectory(string path);
- void CreateOrOverwriteDirectory(string path);
+ void EnsureDirectoryExists(string path);
bool IsValidPathToFile(string path);
void DeleteIfFileExists(string path);
void Move(string source, string destination);
@@ -26,11 +26,11 @@ public bool IsValidPathToDirectory(string path)
}
}
- public void CreateOrOverwriteDirectory(string path)
+ public void EnsureDirectoryExists(string path)
{
if (Directory.Exists(path))
{
- Directory.Delete(path, true);
+ return;
}
Directory.CreateDirectory(path);
View
2 Source/Machine.Specifications.Reporting/Generation/Spark/SparkHtmlReportGenerator.cs
@@ -122,7 +122,7 @@ string CreateResourceDirectoryIn(string directory)
{
var resourcePath = Path.Combine(directory, "resources");
- _fileSystem.CreateOrOverwriteDirectory(resourcePath);
+ _fileSystem.EnsureDirectoryExists(resourcePath);
return resourcePath;
}

0 comments on commit 3f4a961

Please sign in to comment.
Something went wrong with that request. Please try again.