From 83b11865eb0d63bf01744d21a78e08f8627c0852 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Sat, 8 Jan 2011 10:56:54 -0800 Subject: [PATCH] Fix some specflow tests to not being ignored anymore --HG-- branch : 1.x --- src/Orchard.Specs/Bindings/WebAppHosting.cs | 15 ++----- src/Orchard.Specs/PermissionModel.feature | 41 ++++++++++---------- src/Orchard.Specs/PermissionModel.feature.cs | 30 +++++++------- 3 files changed, 41 insertions(+), 45 deletions(-) diff --git a/src/Orchard.Specs/Bindings/WebAppHosting.cs b/src/Orchard.Specs/Bindings/WebAppHosting.cs index e63150b55..10add5711 100644 --- a/src/Orchard.Specs/Bindings/WebAppHosting.cs +++ b/src/Orchard.Specs/Bindings/WebAppHosting.cs @@ -294,29 +294,22 @@ namespace Orchard.Specs.Bindings { Assert.That(Details.ResponseHeaders["Content-Type"], Is.StringMatching(contentType)); } - [Then(@"I should see ""([^""]*)""")] + [Then(@"I should see ""(.*)""")] public void ThenIShouldSee(string text) { Assert.That(Details.ResponseText, Is.StringMatching(text)); } - [Then(@"I should not see ""([^""]*)""")] + [Then(@"I should not see ""(.*)""")] public void ThenIShouldNotSee(string text) { Assert.That(Details.ResponseText, Is.Not.StringContaining(text)); } - [Then(@"the title contains ""([^""]*)""")] + [Then(@"the title contains ""(.*)""")] public void ThenTheTitleContainsText(string text) { ScenarioContext.Current.Pending(); } - - [Then(@"I should see ""([^""]*)"" when I go to ""([^""]*)""")] - public void ThenIShouldSeeWhenIGoTo(string text, string urlPath) { - WhenIGoTo(urlPath); - ThenIShouldSee(text); - } - - [Then(@"I should be denied access when I go to ""([^""]*)""")] + [Then(@"I should be denied access when I go to ""(.*)""")] public void ThenIShouldBeDeniedAccessWhenIGoTo(string urlPath) { WhenIGoTo(urlPath); WhenIAmRedirected(); diff --git a/src/Orchard.Specs/PermissionModel.feature b/src/Orchard.Specs/PermissionModel.feature index da1906fa5..aa480a614 100644 --- a/src/Orchard.Specs/PermissionModel.feature +++ b/src/Orchard.Specs/PermissionModel.feature @@ -1,28 +1,29 @@ Feature: Addition - In order to prevent security model regressions - As a user with specific permissions - I should to be granted or denied access to various actions + In order to prevent security model regressions + As a user with specific permissions + I should to be granted or denied access to various actions @security Scenario: Login can be automated - Given I have installed Orchard - And I have a user "bob" with permissions "AccessFrontEnd" - When I go to "users/account/logoff" - And I go to "users/account/logon" - And I fill in - | name | value | - | userNameOrEmail | bob | - | password | qwerty123! | - And I hit "Sign In" - And I am redirected - Then I should see "Welcome" - And I should see "bob" + Given I have installed Orchard + And I have a user "bob" with permissions "AccessFrontEnd" + When I go to "users/account/logoff" + And I go to "users/account/logon" + And I fill in + | name | value | + | userNameOrEmail | bob | + | password | qwerty123! | + And I hit "Sign In" + And I am redirected + Then I should see "Welcome" + And I should see "bob" @security Scenario: Anonymous user can see the home page but not the dashboard - Given I have installed Orchard - And I have a user "bob" with permissions "AccessFrontEnd" - When I sign in as "bob" - Then I should see "this is the homepage of your new site" when I go to "/" - And I should be denied access when I go to "admin" + Given I have installed Orchard + And I have a user "bob" with permissions "AccessFrontEnd" + When I sign in as "bob" + And I go to "/" + Then I should see "this is the homepage of your new site" + And I should be denied access when I go to "admin" diff --git a/src/Orchard.Specs/PermissionModel.feature.cs b/src/Orchard.Specs/PermissionModel.feature.cs index 593f5e7c1..d90622584 100644 --- a/src/Orchard.Specs/PermissionModel.feature.cs +++ b/src/Orchard.Specs/PermissionModel.feature.cs @@ -63,13 +63,13 @@ namespace Orchard.Specs #line 7 this.ScenarioSetup(scenarioInfo); #line 8 - testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 9 - testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\""); + testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\""); #line 10 - testRunner.When("I go to \"users/account/logoff\""); + testRunner.When("I go to \"users/account/logoff\""); #line 11 - testRunner.And("I go to \"users/account/logon\""); + testRunner.And("I go to \"users/account/logon\""); #line hidden TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -81,15 +81,15 @@ this.ScenarioSetup(scenarioInfo); "password", "qwerty123!"}); #line 12 - testRunner.And("I fill in", ((string)(null)), table1); + testRunner.And("I fill in", ((string)(null)), table1); #line 16 - testRunner.And("I hit \"Sign In\""); + testRunner.And("I hit \"Sign In\""); #line 17 - testRunner.And("I am redirected"); + testRunner.And("I am redirected"); #line 18 - testRunner.Then("I should see \"Welcome\""); + testRunner.Then("I should see \"Welcome\""); #line 19 - testRunner.And("I should see \"bob\""); + testRunner.And("I should see \"bob\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -104,15 +104,17 @@ this.ScenarioSetup(scenarioInfo); #line 22 this.ScenarioSetup(scenarioInfo); #line 23 - testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 24 - testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\""); + testRunner.And("I have a user \"bob\" with permissions \"AccessFrontEnd\""); #line 25 - testRunner.When("I sign in as \"bob\""); + testRunner.When("I sign in as \"bob\""); #line 26 - testRunner.Then("I should see \"this is the homepage of your new site\" when I go to \"/\""); + testRunner.And("I go to \"/\""); #line 27 - testRunner.And("I should be denied access when I go to \"admin\""); + testRunner.Then("I should see \"this is the homepage of your new site\""); +#line 28 + testRunner.And("I should be denied access when I go to \"admin\""); #line hidden testRunner.CollectScenarioErrors(); }