From de949ccdfc26ddfd5c1ffc2131dfd9db7cc13621 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Mon, 29 Nov 2010 16:01:46 -0800 Subject: [PATCH] Adding some spec tests for the routeable part's slug prefix display in the editor (for blogs) --HG-- branch : dev --- .../Bindings/OrchardSiteFactory.cs | 8 +- src/Orchard.Specs/Bindings/WebAppHosting.cs | 15 +- src/Orchard.Specs/Blogs.feature | 24 +- src/Orchard.Specs/Blogs.feature.cs | 234 +++++++++++------- .../Hosting/RequestExtensions.cs | 11 +- src/Orchard.Specs/WebHosting.feature.cs | 82 +++--- 6 files changed, 240 insertions(+), 134 deletions(-) diff --git a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs index a28c02932..972750f32 100644 --- a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs +++ b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs @@ -10,12 +10,18 @@ namespace Orchard.Specs.Bindings { public class OrchardSiteFactory : BindingBase { [Given(@"I have installed Orchard")] public void GivenIHaveInstalledOrchard() { + GivenIHaveInstalledOrchard("/"); + } + + [Given(@"I have installed Orchard at ""(.*)\""")] + public void GivenIHaveInstalledOrchard(string virtualDirectory) { var webApp = Binding(); webApp.GivenIHaveACleanSiteWith(TableData( new { extension = "module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce" }, new { extension = "core", names = "Common, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" }, - new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" })); + new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" }), + virtualDirectory); webApp.WhenIGoTo("Setup"); diff --git a/src/Orchard.Specs/Bindings/WebAppHosting.cs b/src/Orchard.Specs/Bindings/WebAppHosting.cs index 94bd33e4f..ce2712f31 100644 --- a/src/Orchard.Specs/Bindings/WebAppHosting.cs +++ b/src/Orchard.Specs/Bindings/WebAppHosting.cs @@ -60,8 +60,8 @@ namespace Orchard.Specs.Bindings { } [Given(@"I have a clean site")] - public void GivenIHaveACleanSite() { - GivenIHaveACleanSiteBasedOn("Orchard.Web"); + public void GivenIHaveACleanSite(string virtualDirectory = "/") { + GivenIHaveACleanSiteBasedOn("Orchard.Web", virtualDirectory); } [Given(@"I have chosen to deploy modules as source files only")] @@ -71,8 +71,13 @@ namespace Orchard.Specs.Bindings { [Given(@"I have a clean site based on (.*)")] public void GivenIHaveACleanSiteBasedOn(string siteFolder) { + GivenIHaveACleanSiteBasedOn(siteFolder, "/"); + } + + [Given(@"I have a clean site based on (.*) at ""(.*)\""")] + public void GivenIHaveACleanSiteBasedOn(string siteFolder, string virtualDirectory) { _webHost = new WebHost(_orchardTemp); - Host.Initialize(siteFolder, "/"); + Host.Initialize(siteFolder, virtualDirectory ?? "/"); var shuttle = new Shuttle(); Host.Execute(() => { log4net.Config.BasicConfigurator.Configure(new CastleAppender()); @@ -124,8 +129,8 @@ namespace Orchard.Specs.Bindings { } [Given(@"I have a clean site with")] - public void GivenIHaveACleanSiteWith(Table table) { - GivenIHaveACleanSite(); + public void GivenIHaveACleanSiteWith(Table table, string virtualDirectory = "/") { + GivenIHaveACleanSite(virtualDirectory); foreach (var row in table.Rows) { foreach (var name in row["names"].Split(',').Select(x => x.Trim())) { switch (row["extension"]) { diff --git a/src/Orchard.Specs/Blogs.feature b/src/Orchard.Specs/Blogs.feature index 4a14c4328..9dad395d7 100644 --- a/src/Orchard.Specs/Blogs.feature +++ b/src/Orchard.Specs/Blogs.feature @@ -125,4 +125,26 @@ Scenario: Enabling remote blog publishing inserts the appropriate metaweblogapi When I go to "/XmlRpc/LiveWriter/Manifest" Then the content type should be "\btext/xml\b" And I should see "" - And I should see "Metaweblog" \ No newline at end of file + And I should see "Metaweblog" + +Scenario: The virtual path of my installation when not at the root is reflected in the URL example for the slug field when creating a blog or blog post + Given I have installed Orchard at "/OrchardLocal" + When I go to "admin/blogs/create" + Then I should see "http\://localhost/OrchardLocal/" + When I fill in + | name | value | + | Routable.Title | My Blog | + And I hit "Save" + And I go to "admin/blogs/my-blog/posts/create" + Then I should see "http\://localhost/OrchardLocal/my-blog/" + +Scenario: The virtual path of my installation when at the root is reflected in the URL example for the slug field when creating a blog or blog post + Given I have installed Orchard at "/" + When I go to "admin/blogs/create" + Then I should see "http\://localhost/" + When I fill in + | name | value | + | Routable.Title | My Blog | + And I hit "Save" + And I go to "admin/blogs/my-blog/posts/create" + Then I should see "http\://localhost/my-blog/" \ No newline at end of file diff --git a/src/Orchard.Specs/Blogs.feature.cs b/src/Orchard.Specs/Blogs.feature.cs index 5e8c48583..b00e46221 100644 --- a/src/Orchard.Specs/Blogs.feature.cs +++ b/src/Orchard.Specs/Blogs.feature.cs @@ -1,7 +1,7 @@ // ------------------------------------------------------------------------------ // // This code was generated by SpecFlow (http://www.specflow.org/). -// SpecFlow Version:1.3.2.0 +// SpecFlow Version:1.4.0.0 // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if @@ -14,7 +14,7 @@ namespace Orchard.Specs using TechTalk.SpecFlow; - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [NUnit.Framework.TestFixtureAttribute()] [NUnit.Framework.DescriptionAttribute("Blog")] @@ -31,7 +31,7 @@ namespace Orchard.Specs { testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Blog", "In order to add blogs to my site\r\nAs an author\r\nI want to create blogs and create" + - ", publish and edit blog posts", ((string[])(null))); + ", publish and edit blog posts", GenerationTargetLanguage.CSharp, ((string[])(null))); testRunner.OnFeatureStart(featureInfo); } @@ -61,11 +61,11 @@ namespace Orchard.Specs #line 6 this.ScenarioSetup(scenarioInfo); #line 7 -testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 8 -testRunner.When("I go to \"admin\""); + testRunner.When("I go to \"admin\""); #line 9 -testRunner.Then("I should see \"Blogs\""); + testRunner.Then("I should see \"Blogs\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -78,9 +78,9 @@ testRunner.Then("I should see \"Blogs\""); #line 11 this.ScenarioSetup(scenarioInfo); #line 12 -testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 13 -testRunner.When("I go to \"admin/blogs/create\""); + testRunner.When("I go to \"admin/blogs/create\""); #line hidden TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -89,15 +89,15 @@ testRunner.When("I go to \"admin/blogs/create\""); "Routable.Title", "My Blog"}); #line 14 -testRunner.And("I fill in", ((string)(null)), table1); + testRunner.And("I fill in", ((string)(null)), table1); #line 17 -testRunner.And("I hit \"Save\""); + testRunner.And("I hit \"Save\""); #line 18 -testRunner.And("I go to \"my-blog\""); + testRunner.And("I go to \"my-blog\""); #line 19 -testRunner.Then("I should see \"]*>.*?My Blog.*?\""); + testRunner.Then("I should see \"]*>.*?My Blog.*?\""); #line 20 -testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -109,15 +109,15 @@ testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Hi there."}); #line 21 -testRunner.And("I fill in", ((string)(null)), table2); + testRunner.And("I fill in", ((string)(null)), table2); #line 25 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 26 -testRunner.And("I go to \"my-blog/my-post\""); + testRunner.And("I go to \"my-blog/my-post\""); #line 27 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 28 -testRunner.And("I should see \"Hi there.\""); + testRunner.And("I should see \"Hi there.\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -132,9 +132,9 @@ testRunner.And("I should see \"Hi there.\""); #line 30 this.ScenarioSetup(scenarioInfo); #line 31 -testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 32 -testRunner.When("I go to \"admin/blogs/create\""); + testRunner.When("I go to \"admin/blogs/create\""); #line hidden TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -143,11 +143,11 @@ testRunner.When("I go to \"admin/blogs/create\""); "Routable.Title", "My Blog"}); #line 33 -testRunner.And("I fill in", ((string)(null)), table3); + testRunner.And("I fill in", ((string)(null)), table3); #line 36 -testRunner.And("I hit \"Save\""); + testRunner.And("I hit \"Save\""); #line 37 -testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -159,17 +159,17 @@ testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Hi there."}); #line 38 -testRunner.And("I fill in", ((string)(null)), table4); + testRunner.And("I fill in", ((string)(null)), table4); #line 42 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 43 -testRunner.And("I go to \"my-blog/my-post\""); + testRunner.And("I go to \"my-blog/my-post\""); #line 44 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 45 -testRunner.And("I should see \"Hi there.\""); + testRunner.And("I should see \"Hi there.\""); #line 46 -testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -181,17 +181,17 @@ testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Hi there, again."}); #line 47 -testRunner.And("I fill in", ((string)(null)), table5); + testRunner.And("I fill in", ((string)(null)), table5); #line 51 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 52 -testRunner.And("I go to \"my-blog/my-post-2\""); + testRunner.And("I go to \"my-blog/my-post-2\""); #line 53 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 54 -testRunner.And("I should see \"Hi there, again.\""); + testRunner.And("I should see \"Hi there, again.\""); #line 55 -testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -206,15 +206,15 @@ testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Are you still there?"}); #line 56 -testRunner.And("I fill in", ((string)(null)), table6); + testRunner.And("I fill in", ((string)(null)), table6); #line 61 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 62 -testRunner.And("I go to \"my-blog/my-post-3\""); + testRunner.And("I go to \"my-blog/my-post-3\""); #line 63 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 64 -testRunner.And("I should see \"Are you still there?\""); + testRunner.And("I should see \"Are you still there?\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -229,9 +229,9 @@ testRunner.And("I should see \"Are you still there?\""); #line 66 this.ScenarioSetup(scenarioInfo); #line 67 -testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 68 -testRunner.When("I go to \"admin/blogs/create\""); + testRunner.When("I go to \"admin/blogs/create\""); #line hidden TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -240,15 +240,15 @@ testRunner.When("I go to \"admin/blogs/create\""); "Routable.Title", "My Blog"}); #line 69 -testRunner.And("I fill in", ((string)(null)), table7); + testRunner.And("I fill in", ((string)(null)), table7); #line 72 -testRunner.And("I hit \"Save\""); + testRunner.And("I hit \"Save\""); #line 73 -testRunner.And("I go to \"my-blog\""); + testRunner.And("I go to \"my-blog\""); #line 74 -testRunner.Then("I should see \"]*>.*?My Blog.*?\""); + testRunner.Then("I should see \"]*>.*?My Blog.*?\""); #line 75 -testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -260,19 +260,19 @@ testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Hi there."}); #line 76 -testRunner.And("I fill in", ((string)(null)), table8); + testRunner.And("I fill in", ((string)(null)), table8); #line 80 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 81 -testRunner.And("I go to \"my-blog/my-post\""); + testRunner.And("I go to \"my-blog/my-post\""); #line 82 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 83 -testRunner.And("I should see \"Hi there.\""); + testRunner.And("I should see \"Hi there.\""); #line 84 -testRunner.When("I go to \"admin/blogs/my-blog\""); + testRunner.When("I go to \"admin/blogs/my-blog\""); #line 85 -testRunner.And("I follow \"Blog Properties\""); + testRunner.And("I follow \"Blog Properties\""); #line hidden TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -281,19 +281,19 @@ testRunner.And("I follow \"Blog Properties\""); "Routable.Slug", "my-other-blog"}); #line 86 -testRunner.And("I fill in", ((string)(null)), table9); + testRunner.And("I fill in", ((string)(null)), table9); #line 89 -testRunner.And("I hit \"Save\""); + testRunner.And("I hit \"Save\""); #line 90 -testRunner.And("I go to \"my-other-blog\""); + testRunner.And("I go to \"my-other-blog\""); #line 91 -testRunner.Then("I should see \"]*>.*?My Blog.*?\""); + testRunner.Then("I should see \"]*>.*?My Blog.*?\""); #line 92 -testRunner.When("I go to \"my-other-blog/my-post\""); + testRunner.When("I go to \"my-other-blog/my-post\""); #line 93 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 94 -testRunner.And("I should see \"Hi there.\""); + testRunner.And("I should see \"Hi there.\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -306,9 +306,9 @@ testRunner.And("I should see \"Hi there.\""); #line 96 this.ScenarioSetup(scenarioInfo); #line 97 -testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 98 -testRunner.When("I go to \"admin/blogs/create\""); + testRunner.When("I go to \"admin/blogs/create\""); #line hidden TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -317,11 +317,11 @@ testRunner.When("I go to \"admin/blogs/create\""); "Routable.Title", "My Blog"}); #line 99 -testRunner.And("I fill in", ((string)(null)), table10); + testRunner.And("I fill in", ((string)(null)), table10); #line 102 -testRunner.And("I hit \"Save\""); + testRunner.And("I hit \"Save\""); #line 103 -testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -333,15 +333,15 @@ testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Hi there."}); #line 104 -testRunner.And("I fill in", ((string)(null)), table11); + testRunner.And("I fill in", ((string)(null)), table11); #line 108 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 109 -testRunner.And("I am redirected"); + testRunner.And("I am redirected"); #line 110 -testRunner.And("I go to \"my-blog/my-post\""); + testRunner.And("I go to \"my-blog/my-post\""); #line 111 -testRunner.Then("I should see \"\""); #line hidden testRunner.CollectScenarioErrors(); @@ -357,13 +357,13 @@ testRunner.Then("I should see \"\""); #line 125 -testRunner.When("I go to \"/XmlRpc/LiveWriter/Manifest\""); + testRunner.When("I go to \"/XmlRpc/LiveWriter/Manifest\""); #line 126 -testRunner.Then("the content type should be \"\\btext/xml\\b\""); + testRunner.Then("the content type should be \"\\btext/xml\\b\""); #line 127 -testRunner.And("I should see \"\""); #line 128 -testRunner.And("I should see \"Metaweblog\""); + testRunner.And("I should see \"Metaweblog\""); +#line hidden + testRunner.CollectScenarioErrors(); + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("The virtual path of my installation when not at the root is reflected in the URL " + + "example for the slug field when creating a blog or blog post")] + public virtual void TheVirtualPathOfMyInstallationWhenNotAtTheRootIsReflectedInTheURLExampleForTheSlugFieldWhenCreatingABlogOrBlogPost() + { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("The virtual path of my installation when not at the root is reflected in the URL " + + "example for the slug field when creating a blog or blog post", ((string[])(null))); +#line 130 +this.ScenarioSetup(scenarioInfo); +#line 131 + testRunner.Given("I have installed Orchard at \"/OrchardLocal\""); +#line 132 + testRunner.When("I go to \"admin/blogs/create\""); +#line 133 + testRunner.Then("I should see \"http\\://localhost/OrchardLocal/\""); +#line hidden + TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table13.AddRow(new string[] { + "Routable.Title", + "My Blog"}); +#line 134 + testRunner.When("I fill in", ((string)(null)), table13); +#line 137 + testRunner.And("I hit \"Save\""); +#line 138 + testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); +#line 139 + testRunner.Then("I should see \"http\\://localhost/OrchardLocal/my-blog/\""); +#line hidden + testRunner.CollectScenarioErrors(); + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("The virtual path of my installation when at the root is reflected in the URL exam" + + "ple for the slug field when creating a blog or blog post")] + public virtual void TheVirtualPathOfMyInstallationWhenAtTheRootIsReflectedInTheURLExampleForTheSlugFieldWhenCreatingABlogOrBlogPost() + { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("The virtual path of my installation when at the root is reflected in the URL exam" + + "ple for the slug field when creating a blog or blog post", ((string[])(null))); +#line 141 +this.ScenarioSetup(scenarioInfo); +#line 142 + testRunner.Given("I have installed Orchard at \"/\""); +#line 143 + testRunner.When("I go to \"admin/blogs/create\""); +#line 144 + testRunner.Then("I should see \"http\\://localhost/\""); +#line hidden + TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table14.AddRow(new string[] { + "Routable.Title", + "My Blog"}); +#line 145 + testRunner.When("I fill in", ((string)(null)), table14); +#line 148 + testRunner.And("I hit \"Save\""); +#line 149 + testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); +#line 150 + testRunner.Then("I should see \"http\\://localhost/my-blog/\""); #line hidden testRunner.CollectScenarioErrors(); } diff --git a/src/Orchard.Specs/Hosting/RequestExtensions.cs b/src/Orchard.Specs/Hosting/RequestExtensions.cs index d60c140c1..4a5ba60ce 100644 --- a/src/Orchard.Specs/Hosting/RequestExtensions.cs +++ b/src/Orchard.Specs/Hosting/RequestExtensions.cs @@ -6,8 +6,6 @@ using System.Linq; using System.Text; using System.Web; using System.Web.Hosting; -using HtmlAgilityPack; -using Orchard.Commands; using Orchard.Specs.Util; namespace Orchard.Specs.Hosting { @@ -16,12 +14,13 @@ namespace Orchard.Specs.Hosting { var physicalPath = Bleroy.FluentPath.Path.Get(webHost.PhysicalDirectory); + urlPath = StripVDir(urlPath, webHost.VirtualDirectory); var details = new RequestDetails { HostName = webHost.HostName, UrlPath = urlPath, Page = physicalPath .Combine(urlPath.TrimStart('/', '\\')) - .GetRelativePath(physicalPath), + .GetRelativePath(physicalPath) }; if (!string.IsNullOrEmpty(webHost.Cookies)) { @@ -52,6 +51,12 @@ namespace Orchard.Specs.Hosting { return details; } + private static string StripVDir(string urlPath, string virtualDirectory) { + return urlPath.StartsWith(virtualDirectory, StringComparison.OrdinalIgnoreCase) + ? urlPath.Substring(virtualDirectory.Length) + : urlPath; + } + public static RequestDetails SendRequest(this WebHost webHost, string urlPath) { return webHost.SendRequest(urlPath, null); } diff --git a/src/Orchard.Specs/WebHosting.feature.cs b/src/Orchard.Specs/WebHosting.feature.cs index 2f1c2e07b..d8c716192 100644 --- a/src/Orchard.Specs/WebHosting.feature.cs +++ b/src/Orchard.Specs/WebHosting.feature.cs @@ -1,7 +1,7 @@ // ------------------------------------------------------------------------------ // // This code was generated by SpecFlow (http://www.specflow.org/). -// SpecFlow Version:1.3.2.0 +// SpecFlow Version:1.4.0.0 // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if @@ -14,7 +14,7 @@ namespace Orchard.Specs using TechTalk.SpecFlow; - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [NUnit.Framework.TestFixtureAttribute()] [NUnit.Framework.DescriptionAttribute("Web Hosting")] @@ -31,7 +31,7 @@ namespace Orchard.Specs { testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Web Hosting", "In order to test orchard\r\nAs an integration runner\r\nI want to verify basic hostin" + - "g is working", ((string[])(null))); + "g is working", GenerationTargetLanguage.CSharp, ((string[])(null))); testRunner.OnFeatureStart(featureInfo); } @@ -61,13 +61,13 @@ namespace Orchard.Specs #line 6 this.ScenarioSetup(scenarioInfo); #line 7 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 8 -testRunner.When("I go to \"Content/Static.txt\""); + testRunner.When("I go to \"Content/Static.txt\""); #line 9 -testRunner.Then("I should see \"Hello world!\""); + testRunner.Then("I should see \"Hello world!\""); #line 10 -testRunner.And("the status should be 200 \"OK\""); + testRunner.And("the status should be 200 \"OK\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -80,13 +80,13 @@ testRunner.And("the status should be 200 \"OK\""); #line 12 this.ScenarioSetup(scenarioInfo); #line 13 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 14 -testRunner.When("I go to \"Simple/Page.aspx\""); + testRunner.When("I go to \"Simple/Page.aspx\""); #line 15 -testRunner.Then("I should see \"Hello again\""); + testRunner.Then("I should see \"Hello again\""); #line 16 -testRunner.And("the status should be 200 \"OK\""); + testRunner.And("the status should be 200 \"OK\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -99,13 +99,13 @@ testRunner.And("the status should be 200 \"OK\""); #line 18 this.ScenarioSetup(scenarioInfo); #line 19 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 20 -testRunner.When("I go to \"hello-world\""); + testRunner.When("I go to \"hello-world\""); #line 21 -testRunner.Then("the status should be 200 \"OK\""); + testRunner.Then("the status should be 200 \"OK\""); #line 22 -testRunner.And("I should see \"Hello yet again\""); + testRunner.And("I should see \"Hello yet again\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -118,15 +118,15 @@ testRunner.And("I should see \"Hello yet again\""); #line 24 this.ScenarioSetup(scenarioInfo); #line 25 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 26 -testRunner.When("I go to \"/simple/page.aspx\""); + testRunner.When("I go to \"/simple/page.aspx\""); #line 27 -testRunner.And("I follow \"next page\""); + testRunner.And("I follow \"next page\""); #line 28 -testRunner.Then("the status should be 200 \"OK\""); + testRunner.Then("the status should be 200 \"OK\""); #line 29 -testRunner.And("I should see \"Hello yet again\""); + testRunner.And("I should see \"Hello yet again\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -139,9 +139,9 @@ testRunner.And("I should see \"Hello yet again\""); #line 31 this.ScenarioSetup(scenarioInfo); #line 32 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 33 -testRunner.And("I am on \"/simple/page.aspx\""); + testRunner.And("I am on \"/simple/page.aspx\""); #line hidden TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -150,15 +150,15 @@ testRunner.And("I am on \"/simple/page.aspx\""); "input1", "gamma"}); #line 34 -testRunner.When("I fill in", ((string)(null)), table1); + testRunner.When("I fill in", ((string)(null)), table1); #line 37 -testRunner.And("I hit \"Go!\""); + testRunner.And("I hit \"Go!\""); #line 38 -testRunner.Then("I should see \"passthrough1:alpha\""); + testRunner.Then("I should see \"passthrough1:alpha\""); #line 39 -testRunner.And("I should see \"passthrough2:beta\""); + testRunner.And("I should see \"passthrough2:beta\""); #line 40 -testRunner.And("I should see \"input1:gamma\""); + testRunner.And("I should see \"input1:gamma\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -171,13 +171,13 @@ testRunner.And("I should see \"input1:gamma\""); #line 42 this.ScenarioSetup(scenarioInfo); #line 43 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 44 -testRunner.When("I go to \"/simple/cookie-set.aspx\""); + testRunner.When("I go to \"/simple/cookie-set.aspx\""); #line 45 -testRunner.And("I go to \"/simple/cookie-show.aspx\""); + testRunner.And("I go to \"/simple/cookie-show.aspx\""); #line 46 -testRunner.Then("I should see \"foo:bar\""); + testRunner.Then("I should see \"foo:bar\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -190,13 +190,13 @@ testRunner.Then("I should see \"foo:bar\""); #line 48 this.ScenarioSetup(scenarioInfo); #line 49 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 50 -testRunner.When("I go to \"/simple/redir.aspx\""); + testRunner.When("I go to \"/simple/redir.aspx\""); #line 51 -testRunner.And("I am redirected"); + testRunner.And("I am redirected"); #line 52 -testRunner.Then("I should see \"Hello again\""); + testRunner.Then("I should see \"Hello again\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -209,11 +209,11 @@ testRunner.Then("I should see \"Hello again\""); #line 54 this.ScenarioSetup(scenarioInfo); #line 55 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 56 -testRunner.When("I go to \"/Modules/Orchard.Blogs/module.txt\""); + testRunner.When("I go to \"/Modules/Orchard.Blogs/module.txt\""); #line 57 -testRunner.Then("the status should be 404 \"Not Found\""); + testRunner.Then("the status should be 404 \"Not Found\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -226,11 +226,11 @@ testRunner.Then("the status should be 404 \"Not Found\""); #line 59 this.ScenarioSetup(scenarioInfo); #line 60 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 61 -testRunner.When("I go to \"/Themes/Classic/theme.txt\""); + testRunner.When("I go to \"/Themes/Classic/theme.txt\""); #line 62 -testRunner.Then("the status should be 404 \"Not Found\""); + testRunner.Then("the status should be 404 \"Not Found\""); #line hidden testRunner.CollectScenarioErrors(); }