From 31995c55ca7dc8b9be32d02d61bf0870c48a95ef Mon Sep 17 00:00:00 2001 From: Louis DeJardin Date: Tue, 20 Apr 2010 15:07:00 -0700 Subject: [PATCH] Setup submit scenario works Minimum modules are copied Form is submitted Redirect is verified (should have a step to follow redirect) Also changed .Named to .Keyed in a controller test --HG-- branch : dev --- src/Orchard.Specs/Bindings/WebAppHosting.cs | 35 +++++++------- src/Orchard.Specs/Orchard.Specs.csproj | 48 +++++++++++++++++++ src/Orchard.Specs/Setup.feature | 12 ++--- src/Orchard.Specs/Setup.feature.cs | 23 +++++---- .../Mvc/OrchardControllerFactoryTests.cs | 2 +- src/Orchard/Properties/AssemblyInfo.cs | 4 +- 6 files changed, 85 insertions(+), 39 deletions(-) diff --git a/src/Orchard.Specs/Bindings/WebAppHosting.cs b/src/Orchard.Specs/Bindings/WebAppHosting.cs index 3144d2d8e..6c34e63b2 100644 --- a/src/Orchard.Specs/Bindings/WebAppHosting.cs +++ b/src/Orchard.Specs/Bindings/WebAppHosting.cs @@ -61,19 +61,21 @@ namespace Orchard.Specs.Bindings { public void GivenIHaveACleanSiteWith(Table table) { GivenIHaveACleanSite(); foreach (var row in table.Rows) { - switch (row["extension"]) { - case "core": - GivenIHaveCore(row["name"]); - break; - case "module": - GivenIHaveModule(row["name"]); - break; - case "theme": - GivenIHaveTheme(row["name"]); - break; - default: - Assert.Fail("Unknown extension type {0}", row["extension"]); - break; + foreach (var name in row["names"].Split(',').Select(x => x.Trim())) { + switch (row["extension"]) { + case "core": + GivenIHaveCore(name); + break; + case "module": + GivenIHaveModule(name); + break; + case "theme": + GivenIHaveTheme(name); + break; + default: + Assert.Fail("Unknown extension type {0}", row["extension"]); + break; + } } } } @@ -105,13 +107,12 @@ namespace Orchard.Specs.Bindings { [When(@"I fill in")] public void WhenIFillIn(Table table) { var inputs = _doc.DocumentNode - .SelectNodes("//input"); + .SelectNodes("//input") ?? Enumerable.Empty(); foreach (var row in table.Rows) { var r = row; - var input = inputs.Single( - x => x.Attributes.Contains("name") && - x.Attributes["name"].Value == r["name"]); + var input = inputs.SingleOrDefault(x => x.GetAttributeValue("name", x.GetAttributeValue("id", "")) == r["name"]); + Assert.That(input, Is.Not.Null, "Unable to locate name {0} in page html:\r\n\r\n{1}", r["name"], _details.ResponseText); input.Attributes.Add("value", row["value"]); } } diff --git a/src/Orchard.Specs/Orchard.Specs.csproj b/src/Orchard.Specs/Orchard.Specs.csproj index 631eb3819..60a787467 100644 --- a/src/Orchard.Specs/Orchard.Specs.csproj +++ b/src/Orchard.Specs/Orchard.Specs.csproj @@ -144,10 +144,58 @@ + + {9916839C-39FC-4CEB-A5AF-89CA7E87119F} + Orchard.Core + + + {E65E5633-C0FF-453C-A906-481C14F969D6} + Futures.Widgets + + + {63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867} + Orchard.Blogs + + + {14C049FD-B35B-415A-A824-87F26B26E7FD} + Orchard.Comments + + + {67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890} + Orchard.DevTools + + + {D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB} + Orchard.Media + + + {4A9C04A6-0986-4A92-A610-5F59FF273FB9} + Orchard.Pages + + + {D10AD48F-407D-4DB5-A328-173EC7CB010F} + Orchard.Roles + + + {17C44253-65A2-4597-98C7-16EE576824B6} + Orchard.Sandbox + {8C7FCBC2-E6E1-405E-BFB5-D8D9E67A09C4} Orchard.Setup + + {5D0F00F0-26C9-4785-AD61-B85710C60EB0} + Orchard.Tags + + + {79AED36E-ABD0-4747-93D3-8722B042454B} + Orchard.Users + + + {50B779EA-EC00-4699-84C0-03B395C365D2} + Orchard.Web + {2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6} Orchard.Framework diff --git a/src/Orchard.Specs/Setup.feature b/src/Orchard.Specs/Setup.feature index 778de3378..a02372e1c 100644 --- a/src/Orchard.Specs/Setup.feature +++ b/src/Orchard.Specs/Setup.feature @@ -32,16 +32,14 @@ Scenario: Some of the initial form values are required Scenario: Calling setup on a brand new install Given I have a clean site with - | extension | name | - | module | Orchard.Setup | - | core | Themes | - | core | Settings | - | theme | SafeMode | + | extension | names | + | module | Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Pages, Orchard.Comments, TinyMce | + | core | Common, Dashboard, Feeds, HomePage, Navigation, Scheduling, Settings, Themes, XmlRpc | + | theme | SafeMode, Classic | And I am on "/Setup" When I fill in | name | value | | SiteName | My Site | | AdminPassword | 6655321 | And I hit "Finish Setup" - Then I should see "Blah" - + Then the status should be 302 Found diff --git a/src/Orchard.Specs/Setup.feature.cs b/src/Orchard.Specs/Setup.feature.cs index bd09cf02e..57b64f911 100644 --- a/src/Orchard.Specs/Setup.feature.cs +++ b/src/Orchard.Specs/Setup.feature.cs @@ -135,22 +135,21 @@ this.ScenarioSetup(scenarioInfo); #line hidden TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { "extension", - "name"}); + "names"}); table1.AddRow(new string[] { "module", - "Orchard.Setup"}); + "Orchard.Setup, Orchard.Users, Orchard.Roles, Orchard.Pages, Orchard.Comments, Tin" + + "yMce"}); table1.AddRow(new string[] { "core", - "Themes"}); - table1.AddRow(new string[] { - "core", - "Settings"}); + "Common, Dashboard, Feeds, HomePage, Navigation, Scheduling, Settings, Themes, Xml" + + "Rpc"}); table1.AddRow(new string[] { "theme", - "SafeMode"}); + "SafeMode, Classic"}); #line 34 testRunner.Given("I have a clean site with", ((string)(null)), table1); -#line 40 +#line 39 testRunner.And("I am on \"/Setup\""); #line hidden TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] { @@ -162,12 +161,12 @@ this.ScenarioSetup(scenarioInfo); table2.AddRow(new string[] { "AdminPassword", "6655321"}); -#line 41 +#line 40 testRunner.When("I fill in", ((string)(null)), table2); -#line 45 +#line 44 testRunner.And("I hit \"Finish Setup\""); -#line 46 - testRunner.Then("I should see \"Blah\""); +#line 45 + testRunner.Then("the status should be 302 Found"); #line hidden testRunner.CollectScenarioErrors(); } diff --git a/src/Orchard.Tests/Mvc/OrchardControllerFactoryTests.cs b/src/Orchard.Tests/Mvc/OrchardControllerFactoryTests.cs index a63671006..405db453f 100644 --- a/src/Orchard.Tests/Mvc/OrchardControllerFactoryTests.cs +++ b/src/Orchard.Tests/Mvc/OrchardControllerFactoryTests.cs @@ -18,7 +18,7 @@ namespace Orchard.Tests.Mvc { public void Init() { var builder = new ContainerBuilder(); builder.RegisterType() - .Named("controller.orchard.foo") + .Keyed("/foo") .InstancePerDependency(); var container = builder.Build(); diff --git a/src/Orchard/Properties/AssemblyInfo.cs b/src/Orchard/Properties/AssemblyInfo.cs index 09429c973..6906e59aa 100644 --- a/src/Orchard/Properties/AssemblyInfo.cs +++ b/src/Orchard/Properties/AssemblyInfo.cs @@ -34,5 +34,5 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.0.1.0")] +[assembly: AssemblyFileVersion("1.0.1.0")] \ No newline at end of file