--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-11-16 13:26:50 -08:00
6 changed files with 127 additions and 14 deletions

View File

@@ -31,14 +31,14 @@ namespace Orchard.Specs.Bindings {
[BeforeTestRun]
public static void BeforeTestRun() {
if ( _orchardTemp.Exists ) {
_orchardTemp.Delete(true).CreateDirectory();
}
try { _orchardTemp.Delete(true).CreateDirectory(); } catch {}
}
[AfterTestRun]
public static void AfterTestRun() {
_orchardTemp.Delete(true); // <- try to clear any stragglers on the way out
try {
_orchardTemp.Delete(true); // <- try to clear any stragglers on the way out
} catch {}
}
[AfterScenario]

View File

@@ -91,4 +91,34 @@ Scenario: I can create a new blog and blog post and when I change the slug of th
Then I should see "<h1[^>]*>.*?My Blog.*?</h1>"
When I go to "my-other-blog/my-post"
Then I should see "<h1[^>]*>.*?My Post.*?</h1>"
And I should see "Hi there."
And I should see "Hi there."
Scenario: When viewing a blog the user agent is given an RSS feed of the blog's posts
Given I have installed Orchard
When I go to "admin/blogs/create"
And I fill in
| name | value |
| Routable.Title | My Blog |
And I hit "Save"
And I go to "admin/blogs/my-blog/posts/create"
And I fill in
| name | value |
| Routable.Title | My Post |
| Body.Text | Hi there. |
And I hit "Publish Now"
And I am redirected
And I go to "my-blog/my-post"
Then I should see "<link rel="alternate" type="application/rss\+xml" title="My Blog" href="/rss\?containerid=\d+" />"
Scenario: Enabling remote blog publishing inserts the appropriate metaweblogapi markup into the blog's page
Given I have installed Orchard
And I have enabled "XmlRpc"
And I have enabled "Orchard.Blogs.RemotePublishing"
When I go to "admin/blogs/create"
And I fill in
| name | value |
| Routable.Title | My Blog |
And I hit "Save"
And I go to "my-blog"
Then I should see "<link href="[^"]+my-blog/wlwmanifest\.xml" rel="wlwmanifest" type="application/wlwmanifest\+xml" />"

View File

@@ -294,6 +294,92 @@ this.ScenarioSetup(scenarioInfo);
testRunner.Then("I should see \"<h1[^>]*>.*?My Post.*?</h1>\"");
#line 94
testRunner.And("I should see \"Hi there.\"");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("When viewing a blog the user agent is given an RSS feed of the blog\'s posts")]
public virtual void WhenViewingABlogTheUserAgentIsGivenAnRSSFeedOfTheBlogSPosts()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("When viewing a blog the user agent is given an RSS feed of the blog\'s posts", ((string[])(null)));
#line 96
this.ScenarioSetup(scenarioInfo);
#line 97
testRunner.Given("I have installed Orchard");
#line 98
testRunner.When("I go to \"admin/blogs/create\"");
#line hidden
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table10.AddRow(new string[] {
"Routable.Title",
"My Blog"});
#line 99
testRunner.And("I fill in", ((string)(null)), table10);
#line 102
testRunner.And("I hit \"Save\"");
#line 103
testRunner.And("I go to \"admin/blogs/my-blog/posts/create\"");
#line hidden
TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table11.AddRow(new string[] {
"Routable.Title",
"My Post"});
table11.AddRow(new string[] {
"Body.Text",
"Hi there."});
#line 104
testRunner.And("I fill in", ((string)(null)), table11);
#line 108
testRunner.And("I hit \"Publish Now\"");
#line 109
testRunner.And("I am redirected");
#line 110
testRunner.And("I go to \"my-blog/my-post\"");
#line 111
testRunner.Then("I should see \"<link rel=\"alternate\" type=\"application/rss\\+xml\" title=\"My Blog\" h" +
"ref=\"/rss\\?containerid=\\d+\" />\"");
#line hidden
testRunner.CollectScenarioErrors();
}
[NUnit.Framework.TestAttribute()]
[NUnit.Framework.DescriptionAttribute("Enabling remote blog publishing inserts the appropriate metaweblogapi markup into" +
" the blog\'s page")]
public virtual void EnablingRemoteBlogPublishingInsertsTheAppropriateMetaweblogapiMarkupIntoTheBlogSPage()
{
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Enabling remote blog publishing inserts the appropriate metaweblogapi markup into" +
" the blog\'s page", ((string[])(null)));
#line 114
this.ScenarioSetup(scenarioInfo);
#line 115
testRunner.Given("I have installed Orchard");
#line 116
testRunner.And("I have enabled \"XmlRpc\"");
#line 117
testRunner.And("I have enabled \"Orchard.Blogs.RemotePublishing\"");
#line 118
testRunner.When("I go to \"admin/blogs/create\"");
#line hidden
TechTalk.SpecFlow.Table table12 = new TechTalk.SpecFlow.Table(new string[] {
"name",
"value"});
table12.AddRow(new string[] {
"Routable.Title",
"My Blog"});
#line 119
testRunner.And("I fill in", ((string)(null)), table12);
#line 122
testRunner.And("I hit \"Save\"");
#line 123
testRunner.And("I go to \"my-blog\"");
#line 124
testRunner.Then("I should see \"<link href=\"[^\"]+my-blog/wlwmanifest\\.xml\" rel=\"wlwmanifest\" type=\"" +
"application/wlwmanifest\\+xml\" />\"");
#line hidden
testRunner.CollectScenarioErrors();
}

View File

@@ -18,17 +18,16 @@ namespace Orchard.Specs.Hosting {
}
void WebHostCleanup(object sender, EventArgs e) {
_tempSite.Delete(true); // <- try to clean up after the appdomain unloads (still not guaranteed to get everything - probably overkill - might go away)
try {
_tempSite.Delete(true); // <- try to clean up after the appdomain unloads (still not guaranteed to get everything - probably overkill - might go away)
} catch{}
}
public void Initialize(string templateName, string virtualDirectory) {
var baseDir = Path.Get(AppDomain.CurrentDomain.BaseDirectory);
_tempSite = Path.Get(_orchardTemp).Combine(System.IO.Path.GetRandomFileName());
if(_tempSite.Exists) {
_tempSite.Delete();
}
try { _tempSite.Delete(); } catch {}
_tempSite.CreateDirectory();
// Trying the two known relative paths to the Orchard.Web directory.

View File

@@ -1,7 +1,5 @@
using JetBrains.Annotations;
using Orchard.Blogs.Models;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.ContentManagement.Drivers;
using Orchard.Environment.Extensions;
@@ -10,7 +8,7 @@ namespace Orchard.Blogs.Drivers {
[OrchardFeature("Orchard.Blogs.RemotePublishing")]
public class RemoteBlogPublishingDriver : ContentPartDriver<BlogPart> {
protected override DriverResult Display(BlogPart part, string displayType, dynamic shapeHelper) {
return ContentShape("Parts_Blogs_RemotePublishing", shape => shape.Path(part.As<IRoutableAspect>().Path));
return ContentShape("Parts_Blogs_RemotePublishing", shape => shape.Blog(part));
}
}
}

View File

@@ -2,7 +2,7 @@
@using Orchard.Blogs.Models;
@using Orchard.UI.Resources;
@{
BlogPart blog = Model;
BlogPart blog = Model.Blog;
RegisterLink(new LinkEntry { Rel = "wlwmanifest", Type = "application/wlwmanifest+xml", Href = Url.BlogLiveWriterManifest(blog) });
RegisterLink(new LinkEntry { Rel = "EditURI", Type = "application/rsd+xml", Title = "RSD", Href = Url.BlogRsd(blog) });
}