📖 new default post content (#8548)

closes #8542
- updates default post fixtures
- adds default logo and cover images to settings fixtures
- update tests due to coupling to dev/prod fixtures
This commit is contained in:
Kevin Ansfield 2017-06-08 16:36:14 +01:00 committed by David Wolfe
parent d823412987
commit f675a962cf
15 changed files with 196 additions and 98 deletions

View File

@ -146,7 +146,7 @@ describe('AMP getPostData', function () {
beforeEach(function () {
res = {
locals: {
relativeUrl: '/welcome-to-ghost/amp/'
relativeUrl: '/welcome/amp/'
}
};
@ -168,7 +168,7 @@ describe('AMP getPostData', function () {
postLookupStub.returns(new Promise.resolve({
post: {
id: '1',
slug: 'welcome-to-ghost'
slug: 'welcome'
}
}));
@ -177,7 +177,7 @@ describe('AMP getPostData', function () {
ampController.getPostData(req, res, function () {
req.body.post.should.be.eql({
id: '1',
slug: 'welcome-to-ghost'
slug: 'welcome'
}
);
done();

View File

@ -218,7 +218,7 @@ describe('Private Blogging', function () {
});
it('authenticatePrivateSession should redirect if hash is not verified', function (done) {
req.url = '/welcome-to-ghost';
req.url = '/welcome';
req.session = {
token: 'wrongpassword',
salt: Date.now().toString()

View File

@ -21,10 +21,10 @@
"defaultValue": "Just a blogging platform."
},
"logo": {
"defaultValue": ""
"defaultValue": "https://casper.ghost.org/v1.0.0/images/ghost-logo.svg"
},
"cover_image": {
"defaultValue": ""
"defaultValue": "https://casper.ghost.org/v1.0.0/images/blog-cover.jpg"
},
"icon": {
"defaultValue": ""

View File

@ -3,11 +3,77 @@
{
"name": "Post",
"entries": [
{
"title": "Setting up your own Ghost theme",
"slug": "themes",
"mobiledoc": "{\"version\":\"0.3.1\",\"markups\":[],\"atoms\":[],\"cards\":[[\"card-markdown\",{\"cardName\":\"card-markdown\",\"markdown\":\"Creating a totally custom design for your publication\\n\\nGhost comes with a beautiful default theme called Casper, which is designed to be a clean, readable publication layout and can be easily adapted for most purposes. However, Ghost can also be completely themed to suit your needs. Rather than just giving you a few basic settings which act as a poor proxy for code, we just let you write code.\\n\\nThere are a huge range of both free and premium pre-built themes which you can get from the [Ghost Theme Marketplace](http:\/\/marketplace.ghost.org), or you can simply create your own from scratch.\\n\\n[![marketplace](https:\/\/casper.ghost.org\/v1.0.0\/images\/marketplace.jpg)](http:\/\/marketplace.ghost.org)\\n\\n> Anyone can write a completely custom Ghost theme, with just some solid knowledge of HTML and CSS\\n\\nGhost themes are written with a templating language called handlebars, which has a bunch of dynamic helpers to insert your data into template files. Like `{{author.name}}`, for example, outputs the name of the current author.\\n\\nThe best way to learn how to write your own Ghost theme is to have a look at [the source code for Casper](https:\/\/github.com\/TryGhost\/Casper), which is heavily commented and should give you a sense of how everything fits together.\\n\\n- `default.hbs` is the main template file, all contexts will load inside this file unless specifically told to use a different template.\\n- `post.hbs` is the file used in the context of viewing a post.\\n- `index.hbs` is the file used in the context of viewing the home page.\\n- and so on\\n\\nWe've got [full and extensive theme documentation](http:\/\/themes.ghost.org\/docs\/about) which outlines every template file, context and helper that you can use.\\n\\nIf you want to chat with other people making Ghost themes to get any advice or help, there's also a **#themes** channel in our [public Slack community](https:\/\/slack.ghost.org) which we always recommend joining!\"}]],\"sections\":[[10,0]]}",
"feature_image": "https://casper.ghost.org/v1.0.0/images/design.jpg",
"featured": false,
"page": false,
"status": "published",
"meta_title": null,
"meta_description": null
},
{
"title": "Advanced Markdown tips",
"slug": "advanced-markdown",
"mobiledoc": "{\"version\":\"0.3.1\",\"markups\":[],\"atoms\":[],\"cards\":[[\"card-markdown\",{\"cardName\":\"card-markdown\",\"markdown\":\"There are lots of powerful things you can do with the Ghost editor\\n\\nIf you've gotten pretty comfortable with [all the basics](\/the-editor\/) of writing in Ghost, then you may enjoy some more advanced tips about the types of things you can do with Markdown!\\n\\nAs with the last post about the editor, you'll want to be actually editing this post as you read it so that you can see all the Markdown code we're using.\\n\\n\\n## Special formatting\\n\\nAs well as bold and italics, you can also use some other special formatting in Markdown when the need arises, for example:\\n\\n+ ~~strike through~~\\n+ ==highlight==\\n+ \\\\*escaped characters\\\\*\\n\\n\\n## Writing code blocks\\n\\nThere are two types of code elements which can be inserted in Markdown, the first is inline, and the other is block. Inline code is formatted by wrapping any word or words in back-ticks, `like this`. Larger snippets of code can be displayed across multiple lines using triple back ticks:\\n\\n```\\n.my-link {\\n text-decoration: underline;\\n}\\n```\\n\\nIf you want to get really fancy, you can even add syntax highlighting using [Prism.js](http:\/\/prismjs.com\/).\\n\\n\\n## Full bleed images\\n\\nOne neat trick which you can use in Markdown to distinguish between different types of images is to add a `#hash` value to the end of the source URL, and then target images containing the hash with special styling. For example:\\n\\n![walking](https:\/\/casper.ghost.org\/v1.0.0\/images\/walking.jpg#full)\\n\\nwhich is styled with...\\n\\n```\\nimg[src$=\\\"#full\\\"] {\\n max-width: 100vw;\\n}\\n```\\n\\nThis creates full-bleed images in the Casper theme, which stretch beyond their usual boundaries right up to the edge of the window. Every theme handles these types of things slightly differently, but it's a great trick to play with if you want to have a variety of image sizes and styles.\\n\\n\\n## Reference lists\\n\\n**The quick brown [fox][1], jumped over the lazy [dog][2].**\\n\\n[1]: https:\/\/en.wikipedia.org\/wiki\/Fox \\\"Wikipedia: Fox\\\"\\n[2]: https:\/\/en.wikipedia.org\/wiki\/Dog \\\"Wikipedia: Dog\\\"\\n\\nAnother way to insert links in markdown is using reference lists. You might want to use this style of linking to cite reference material in a Wikipedia-style. All of the links are listed at the end of the document, so you can maintain full separation between content and its source or reference.\\n\\n\\n## Creating footnotes\\n\\nThe quick brown fox[^1] jumped over the lazy dog[^2].\\n\\n[^1]: Foxes are red\\n[^2]: Dogs are usually not red\\n\\nFootnotes are a great way to add additional contextual details when appropriate. Ghost will automatically add footnote content to the very end of your post.\\n\\n\\n## Full HTML\\n\\nPerhaps the best part of Markdown is that you're never limited to just Markdown. You can write HTML directly in the Ghost editor and it will just work as HTML usually does. No limits! Here's a standard YouTube embed code as an example:\\n\\n<iframe width=\\\"560\\\" height=\\\"315\\\" src=\\\"https:\/\/www.youtube.com\/embed\/Cniqsc9QfDo?rel=0&amp;showinfo=0\\\" frameborder=\\\"0\\\" allowfullscreen><\/iframe>\\n\"}]],\"sections\":[[10,0]]}",
"feature_image": "https://casper.ghost.org/v1.0.0/images/advanced.jpg",
"featured": false,
"page": false,
"status": "published",
"meta_title": null,
"meta_description": null
},
{
"title": "Making your site private",
"slug": "private-sites",
"mobiledoc": "{\"version\":\"0.3.1\",\"markups\":[],\"atoms\":[],\"cards\":[[\"card-markdown\",{\"cardName\":\"card-markdown\",\"markdown\":\"Sometimes you might want to put your site behind closed doors\\n\\nIf you've got a publication that you don't want the world to see yet because it's not ready to launch, you can hide your Ghost site behind a simple shared pass-phrase.\\n\\nYou can toggle this preference on at the bottom of Ghost's General Settings\\n\\n![private](https://casper.ghost.org/v1.0.0/images/private.png)\\n\\nGhost will give you a short, randomly generated pass-phrase which you can share with anyone who needs access to the site while you're working on it. While this setting is enabled, all search engine optimisation features will be switched off to help keep the site off the radar.\\n\\nDo remember though, this is *not* secure authentication. You shouldn't rely on this feature for protecting important private data. It's just a simple, shared pass-phrase for very basic privacy.\"}]],\"sections\":[[10,0]]}",
"feature_image": "https://casper.ghost.org/v1.0.0/images/locked.jpg",
"featured": false,
"page": false,
"status": "published",
"meta_title": null,
"meta_description": null
},
{
"title": "Managing Ghost users",
"slug": "managing-users",
"mobiledoc": "{\"version\":\"0.3.1\",\"markups\":[],\"atoms\":[],\"cards\":[[\"card-markdown\",{\"cardName\":\"card-markdown\",\"markdown\":\"Ghost has a number of different user roles for your team\\n\\n\\n### Authors\\n\\nThe base user level in Ghost is an author. Authors can write posts, edit their own posts, and publish their own posts. Authors are **trusted** users. If you don't trust users to be allowed to publish their own posts, you shouldn't invite them to Ghost admin.\\n\\n\\n### Editors\\n\\nEditors are the 2nd user level in Ghost. Editors can do everything that an Author can do, but they can also edit and publish the posts of others - as well as their own. Editors can also invite new authors to the site.\\n\\n\\n### Administrators\\n\\nThe top user level in Ghost is Administrator. Again, administrators can do everything that Authors and Editors can do, but they can also edit all site settings and data, not just content. Additionally, administrators have full access to invite, manage or remove any other user of the site.\\n\\n\\n### The Owner\\n\\nThere is only ever one owner of a Ghost site. The owner is a special user which has all the same permissions as an Administrator, but with two exceptions: The Owner can never be deleted. And in some circumstances the owner will have access to additional special settings if applicable — for example, billing details, if using Ghost(Pro).\\n\\n---\\n\\nIt's a good idea to ask all of your users to fill out their user profiles, including bio and social links. These will populate rich structured data for posts and generally create more opportunities for themes to fully populate their design. \"}]],\"sections\":[[10,0]]}",
"feature_image": "https://casper.ghost.org/v1.0.0/images/team.jpg",
"featured": false,
"page": false,
"status": "published",
"meta_title": null,
"meta_description": null
},
{
"title": "Organising your content with tags",
"slug": "using-tags",
"mobiledoc": "{\"version\":\"0.3.1\",\"markups\":[],\"atoms\":[],\"cards\":[[\"card-markdown\",{\"cardName\":\"card-markdown\",\"markdown\":\"Ghost has a single, powerful organisational taxonomy, called tags.\\n\\nIt doesn't matter whether you want to call them categories, tags, boxes, or anything else. You can think of Ghost tags a lot like Gmail labels. By tagging posts with one or more keyword, you can organise articles into buckets of related content.\\n\\n\\n## Basic tagging\\n\\nWhen you write a post, you can assign tags to help differentiate between categories of content. For example, you might tag some posts with `News` and other posts with `Cycling`, which would create two distinct categories of content listed on `/tag/news/` and `/tag/cycling/`, respectively.\\n\\nIf you tag a post with both `News` *and* `Cycling` - then it appears in both sections.\\n\\nTag archives are like dedicated home-pages for each category of content that you have. They have their own pages, their own RSS feeds, and can support their own cover images and meta data.\\n\\n\\n## The primary tag\\n\\nInside the Ghost editor, you can drag and drop tags into a specific order. The first tag in the list is always given the most importance, and some themes will only display the primary tag (the first tag in the list) by default. So you can add the most important tag which you want to show up in your theme, but also add a bunch of related tags which are less important.\\n\\n==**News**, Cycling, Bart Stevens, Extreme Sports==\\n\\nIn this example, **News** is the primary tag which will be displayed by the theme, but the post will also still receive all the other tags, and show up in their respective archives.\\n\\n\\n## Private tags\\n\\nSometimes you may want to assign a post a specific tag, but you don't necessarily want that tag appearing in the theme or creating an archive page. In Ghost, hashtags are private and can be used for special styling.\\n\\nFor example, if you sometimes publish posts with video content - you might want your theme to adapt and get rid of the sidebar for these posts, to give more space for an embedded video to fill the screen. In this case, you could use private tags to tell your theme what to do.\\n\\n==**News**, Cycling, #video==\\n\\nHere, the theme would assign the post publicly displayed tags of `News`, and `Cycling` - but it would also keep a private record of the post being tagged with `#video`.\\n\\nIn your theme, you could then look for private tags conditionally and give them special formatting:\\n\\n```\\n{{#post}}\\n {{#has tag=\\\"#video\\\"}}\\n ...markup for a nice big video post layout...\\n {{else}}\\n ...regular markup for a post...\\n {{/has}}\\n{{/post}}\\n```\\n\\nYou can find documentation for theme development techniques like this and many more over on Ghost's extensive [theme documentation](https://themes.ghost.org/).\"}]],\"sections\":[[10,0]]}",
"feature_image": "https://casper.ghost.org/v1.0.0/images/tags.jpg",
"featured": false,
"page": false,
"status": "published",
"meta_title": null,
"meta_description": null
},
{
"title": "Using the Ghost editor",
"slug": "the-editor",
"mobiledoc": "{\"version\":\"0.3.1\",\"markups\":[],\"atoms\":[],\"cards\":[[\"card-markdown\",{\"cardName\":\"card-markdown\",\"markdown\":\"Ghost uses a language called **Markdown** to format text.\\n\\nWhen you go to edit a post and see special characters and colours intertwined between the words, those are Markdown shortcuts which tell Ghost what to do with the words in your document. The biggest benefit of Markdown is that you can quickly apply formatting as you type, without needing to pause.\\n\\nAt the bottom of the editor, you'll find a toolbar with basic formatting options to help you get started as easily as possible. You'll also notice that there's a **?** icon, which contains more advanced shortcuts.\\n\\nFor now, though, let's run you through some of the basics. You'll want to make sure you're editing this post in order to see all the Markdown we've used.\\n\\n\\n## Formatting text\\n\\nThe most common shortcuts are of course, **bold** text, _italic_ text, and [hyperlinks](https://example.com). These generally make up the bulk of any document. You can type the characters out, but you can also use keyboard shortcuts.\\n\\n* `CMD/Ctrl + B` for Bold\\n* `CMD/Ctrl + I` for Italic\\n* `CMD/Ctrl + K` for a Link\\n* `CMD/Ctrl + H` for a Heading (Press multiple times for h2/h3/h4/etc)\\n\\nWith just a couple of extra characters here and there, you're well on your way to creating a beautifully formatted story.\\n\\n\\n## Inserting images\\n\\nImages in Markdown look just the same as links, except they're prefixed with an exclamation mark, like this:\\n\\n`![Image description](/path/to/image.jpg)`\\n\\n![Computer](https://casper.ghost.org/v1.0.0/images/computer.jpg)\\n\\nMost Markdown editors don't make you type this out, though. In Ghost you can click on the image icon in the toolbar at the bottom of the editor, or you can just click and drag an image from your desktop directly into the editor. Both will upload the image for you and generate the appropriate Markdown.\\n\\n_**Important Note:** Ghost does not currently have automatic image resizing, so it's always a good idea to make sure your images aren't gigantic files **before** uploading them to Ghost._\\n\\n\\n## Making lists\\n\\nLists in HTML are a formatting nightmare, but in Markdown they become an absolute breeze with just a couple of characters and a bit of smart automation. For numbered lists, just write out the numbers. For bullet lists, just use `*` or `-` or `+`. Like this:\\n\\n1. Crack the eggs over a bowl\\n2. Whisk them together\\n3. Make an omellete\\n\\nor\\n\\n- Remember to buy milk\\n- Feed the cat\\n- Come up with idea for next story\\n\\n\\n## Adding quotes\\n\\nWhen you want to pull out a particularly good except in the middle of a piece, you can use `>` at the beginning of a paragraph to turn it into a Blockquote. You might've seen this formatting before in email clients.\\n\\n> A well placed quote guides a reader through a story, helping them to understand the most important points being made\\n\\nAll themes handles blockquotes slightly differently. Sometimes they'll look better kept shorter, while other times you can quote fairly hefty amounts of text and get away with it. Generally, the safest option is to use blockquotes sparingly.\\n\\n\\n## Dividing things up\\n\\nIf you're writing a piece in parts and you just feel like you need to divide a couple of sections distinctly from each other, a horizontal rule might be just what you need. Dropping `---` on a new line will create a sleak divider, anywhere you want it.\\n\\n---\\n\\nThis should get you going with the vast majority of what you need to do in the editor, but if you're still curious about more advanced tips then check out the [Advanced Markdown Guide](/advanced-markdown/) - or if you'd rather learn about how Ghost taxononomies work, we've got a overview of [how to use Ghost tags](/using-tags/).\"}]],\"sections\":[[10,0]]}",
"feature_image": "https://casper.ghost.org/v1.0.0/images/writing.jpg",
"featured": false,
"page": false,
"status": "published",
"meta_title": null,
"meta_description": null
},
{
"title": "Welcome to Ghost",
"slug": "welcome-to-ghost",
"mobiledoc": "{\"version\":\"0.3.1\",\"markups\":[],\"atoms\":[],\"cards\":[[\"card-markdown\",{\"cardName\":\"card-markdown\",\"markdown\":\"Click here to learn more about our all-new editor and improved admin panel 📖 ➡️\\n\\nThis post is a placeholder for brand new content that is coming soon...\"}]],\"sections\":[[10,0]]}",
"image": null,
"slug": "welcome",
"mobiledoc": "{\"version\":\"0.3.1\",\"markups\":[],\"atoms\":[],\"cards\":[[\"card-markdown\",{\"cardName\":\"card-markdown\",\"markdown\":\"Hey! Welcome to Ghost, it's great to have you :)\\n\\nWe know that first impressions are important, so we've populated your new site with some initial **Getting Started** posts that will help you get familiar with everything in no time. This is the first one!\\n\\n\\n### There are a few things that you should know up-front:\\n\\n1. Ghost is designed for ambitious, professional publishers who want to actively build a business around their content. That's who it works best for. If you're using Ghost for some other purpose, that's fine too - but it might not be the best choice for you.\\n\\n2. The entire platform can be modified and customized to suit your needs, which is very powerful, but doing so **does** require some knowledge of code. Ghost is not necessarily a good platform for beginners or people who just want a simple personal blog.\\n\\n3. For the best experience we recommend downloading the [Ghost Desktop App](https://ghost.org/downloads/) for your computer, which is the best way to access your Ghost site on a desktop device.\\n\\nGhost is made by an independent non-profit organisation called the Ghost Foundation. We are 100% self funded by revenue from our [Ghost(Pro)](https://ghost.org/pricing) service, and every penny we make is re-invested into funding further development of free, open source technology for modern journalism.\\n\\nThe main thing you'll want to read about next is probably: [the Ghost editor](/the-editor/).\"}]],\"sections\":[[10,0]]}",
"feature_image": "https://casper.ghost.org/v1.0.0/images/welcome.jpg",
"featured": false,
"page": false,
"status": "published",
@ -396,6 +462,12 @@
"match": "name"
},
"entries": {
"Setting up your own Ghost theme": ["Getting Started"],
"Advanced Markdown tips": ["Getting Started"],
"Making your site private": ["Getting Started"],
"Managing Ghost users": ["Getting Started"],
"Organising your content with tags": ["Getting Started"],
"Using the Ghost editor": ["Getting Started"],
"Welcome to Ghost": ["Getting Started"]
}
},

View File

@ -62,6 +62,15 @@ function ping(post, options) {
return getSlackSettings().then(function (slackSettings) {
// Quit here if slack integration is not activated
var defaultPostSlugs = [
'welcome',
'the-editor',
'using-tags',
'managing-users',
'private-sites',
'advanced-markdown',
'themes'
];
if (slackSettings.url && slackSettings.url !== '') {
// Only ping when not a page
@ -69,11 +78,11 @@ function ping(post, options) {
return;
}
// Don't ping for the welcome to ghost post.
// Don't ping for the default posts.
// This also handles the case where during ghost's first run
// models.init() inserts this post but permissions.init() hasn't
// (can't) run yet.
if (post.slug === 'welcome-to-ghost') {
if (defaultPostSlugs.indexOf(post.slug) > -1) {
return;
}

View File

@ -21,17 +21,26 @@ pingList = [{
function ping(post) {
var pingXML,
title = post.title,
url = utils.url.urlFor('post', {post: post}, true);
url = utils.url.urlFor('post', {post: post}, true),
defaultPostSlugs = [
'welcome',
'the-editor',
'using-tags',
'managing-users',
'private-sites',
'advanced-markdown',
'themes'
];
if (post.page || config.isPrivacyDisabled('useRpcPing')) {
return;
}
// Don't ping for the welcome to ghost post.
// Don't ping for the default posts.
// This also handles the case where during ghost's first run
// models.init() inserts this post but permissions.init() hasn't
// (can't) run yet.
if (post.slug === 'welcome-to-ghost') {
if (defaultPostSlugs.indexOf(post.slug) > -1) {
return;
}

View File

@ -50,7 +50,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(5);
jsonResponse.posts.should.have.length(11);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post');
testUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination');
_.isBoolean(jsonResponse.posts[0].featured).should.eql(true);
@ -75,7 +75,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(5);
jsonResponse.posts.should.have.length(11);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post', ['mobiledoc'], ['html']);
testUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination');
_.isBoolean(jsonResponse.posts[0].featured).should.eql(true);
@ -100,7 +100,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(5);
jsonResponse.posts.should.have.length(11);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post', ['mobiledoc', 'plaintext', 'amp'], ['html']);
testUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination');
_.isBoolean(jsonResponse.posts[0].featured).should.eql(true);
@ -125,7 +125,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(5);
jsonResponse.posts.should.have.length(11);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post', ['plaintext'], ['html']);
testUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination');
_.isBoolean(jsonResponse.posts[0].featured).should.eql(true);
@ -150,7 +150,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(5);
jsonResponse.posts.should.have.length(11);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post');
testUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination');
_.isBoolean(jsonResponse.posts[0].featured).should.eql(true);
@ -175,7 +175,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(5);
jsonResponse.posts.should.have.length(11);
testUtils.API.checkResponse(
jsonResponse.posts[0],
@ -206,7 +206,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(6);
jsonResponse.posts.should.have.length(12);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post');
testUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination');
done();
@ -230,7 +230,7 @@ describe('Post API', function () {
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(9);
jsonResponse.posts.should.have.length(15);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post');
testUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination');
done();
@ -358,7 +358,7 @@ describe('Post API', function () {
});
it('can retrieve a post by slug', function (done) {
request.get(testUtils.API.getApiQuery('posts/slug/welcome-to-ghost/'))
request.get(testUtils.API.getApiQuery('posts/slug/welcome/'))
.set('Authorization', 'Bearer ' + accesstoken)
.expect('Content-Type', /json/)
.expect('Cache-Control', testUtils.cacheRules.private)
@ -373,7 +373,7 @@ describe('Post API', function () {
should.exist(jsonResponse);
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post');
jsonResponse.posts[0].slug.should.equal('welcome-to-ghost');
jsonResponse.posts[0].slug.should.equal('welcome');
jsonResponse.posts[0].page.should.not.be.ok();
_.isBoolean(jsonResponse.posts[0].featured).should.eql(true);
_.isBoolean(jsonResponse.posts[0].page).should.eql(true);

View File

@ -65,7 +65,7 @@ describe('Public API', function () {
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(5);
jsonResponse.posts.should.have.length(11);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post');
testUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination');
_.isBoolean(jsonResponse.posts[0].featured).should.eql(true);
@ -92,7 +92,7 @@ describe('Public API', function () {
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(5);
jsonResponse.posts.should.have.length(11);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post');
testUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination');
_.isBoolean(jsonResponse.posts[0].featured).should.eql(true);
@ -116,7 +116,7 @@ describe('Public API', function () {
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(5);
jsonResponse.posts.should.have.length(11);
testUtils.API.checkResponse(jsonResponse.posts[0], 'post');
testUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination');
_.isBoolean(jsonResponse.posts[0].featured).should.eql(true);

View File

@ -67,18 +67,26 @@ describe('Channel Routes', function () {
should.exist(res.headers.date);
$('title').text().should.equal('Ghost');
$('.content .post').length.should.equal(1);
$('.content .post').length.should.equal(5);
$('.poweredby').text().should.equal('Proudly published with Ghost');
$('body.home-template').length.should.equal(1);
$('article.post').length.should.equal(1);
$('article.tag-getting-started').length.should.equal(1);
$('article.post').length.should.equal(5);
$('article.tag-getting-started').length.should.equal(5);
done();
});
});
it('should not have as second page', function (done) {
it('should have a second page', function (done) {
request.get('/page/2/')
.expect('Content-Type', /html/)
.expect('Cache-Control', testUtils.cacheRules.public)
.expect(200)
.end(doEnd(done));
});
it('should not have a third page', function (done) {
request.get('/page/3/')
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(404)
.expect(/Page not found/)
@ -138,13 +146,13 @@ describe('Channel Routes', function () {
describe('Paged', function () {
// Add enough posts to trigger pages for both the index (5 pp) and rss (15 pp)
// insertPosts adds 5 published posts, 1 draft post, 1 published static page and one draft page
// we then insert with max 11 which ensures we have 16 published posts
// insertPosts adds 11 published posts, 1 draft post, 1 published static page and one draft page
// we then insert with max 5 which ensures we have 16 published posts
before(function (done) {
testUtils.initData().then(function () {
return testUtils.fixtures.insertPostsAndTags();
}).then(function () {
return testUtils.fixtures.insertMorePosts(11);
return testUtils.fixtures.insertMorePosts(5);
}).then(function () {
done();
}).catch(done);
@ -496,7 +504,7 @@ describe('Channel Routes', function () {
});
it('should 404 if page too high', function (done) {
request.get('/author/ghost-owner/page/4/')
request.get('/author/ghost-owner/page/6/')
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(404)
.expect(/Page not found/)
@ -521,7 +529,7 @@ describe('Channel Routes', function () {
});
it('should 404 if page too high', function (done) {
request.get('/author/ghost-owner/rss/2/')
request.get('/author/ghost-owner/rss/3/')
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(404)
.expect(/Page not found/)

View File

@ -90,7 +90,7 @@ describe('Frontend Routing', function () {
it('should load a post with date permalink', function (done) {
var date = moment().format('YYYY/MM/DD');
request.get('/' + date + '/welcome-to-ghost/')
request.get('/' + date + '/welcome/')
.expect(200)
.expect('Content-Type', /html/)
.end(doEnd(done));
@ -99,11 +99,11 @@ describe('Frontend Routing', function () {
it('expect redirect because of wrong/old permalink prefix', function (done) {
var date = moment().format('YYYY/MM/DD');
request.get('/2016/04/01/welcome-to-ghost/')
request.get('/2016/04/01/welcome/')
.expect('Content-Type', /html/)
.end(function (err, res) {
res.status.should.eql(301);
request.get('/' + date + '/welcome-to-ghost/')
request.get('/' + date + '/welcome/')
.expect(200)
.expect('Content-Type', /html/)
.end(doEnd(done));
@ -130,7 +130,7 @@ describe('Frontend Routing', function () {
dd = todayMoment.format('DD'),
mm = todayMoment.format('MM'),
yyyy = todayMoment.format('YYYY'),
postLink = '/' + yyyy + '/' + mm + '/' + dd + '/welcome-to-ghost/';
postLink = '/' + yyyy + '/' + mm + '/' + dd + '/welcome/';
content.indexOf(postLink).should.be.above(0);
done();
@ -186,16 +186,16 @@ describe('Frontend Routing', function () {
describe('Single post', function () {
it('should redirect without slash', function (done) {
request.get('/welcome-to-ghost')
.expect('Location', '/welcome-to-ghost/')
request.get('/welcome')
.expect('Location', '/welcome/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('should redirect uppercase', function (done) {
request.get('/Welcome-To-Ghost/')
.expect('Location', '/welcome-to-ghost/')
request.get('/Welcome/')
.expect('Location', '/welcome/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
@ -210,7 +210,7 @@ describe('Frontend Routing', function () {
});
it('should respond with html for valid url', function (done) {
request.get('/welcome-to-ghost/')
request.get('/welcome/')
.expect('Content-Type', /html/)
.expect('Cache-Control', testUtils.cacheRules.public)
.expect(200)
@ -242,7 +242,7 @@ describe('Frontend Routing', function () {
// get today's date
var date = moment().format('YYYY/MM/DD');
request.get('/' + date + '/welcome-to-ghost/')
request.get('/' + date + '/welcome/')
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(404)
.expect(/Page not found/)
@ -252,15 +252,15 @@ describe('Frontend Routing', function () {
describe('Post edit', function () {
it('should redirect without slash', function (done) {
request.get('/welcome-to-ghost/edit')
.expect('Location', '/welcome-to-ghost/edit/')
request.get('/welcome/edit')
.expect('Location', '/welcome/edit/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('should redirect to editor', function (done) {
request.get('/welcome-to-ghost/edit/')
request.get('/welcome/edit/')
.expect('Location', /ghost\/editor\/\w+/)
.expect('Cache-Control', testUtils.cacheRules.public)
.expect(302)
@ -268,7 +268,7 @@ describe('Frontend Routing', function () {
});
it('should 404 for non-edit parameter', function (done) {
request.get('/welcome-to-ghost/notedit/')
request.get('/welcome/notedit/')
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(404)
.expect(/Page not found/)
@ -278,23 +278,23 @@ describe('Frontend Routing', function () {
describe('AMP post', function () {
it('should redirect without slash', function (done) {
request.get('/welcome-to-ghost/amp')
.expect('Location', '/welcome-to-ghost/amp/')
request.get('/welcome/amp')
.expect('Location', '/welcome/amp/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('should redirect uppercase', function (done) {
request.get('/Welcome-To-Ghost/AMP/')
.expect('Location', '/welcome-to-ghost/amp/')
request.get('/Welcome/AMP/')
.expect('Location', '/welcome/amp/')
.expect('Cache-Control', testUtils.cacheRules.year)
.expect(301)
.end(doEnd(done));
});
it('should respond with html for valid url', function (done) {
request.get('/welcome-to-ghost/amp/')
request.get('/welcome/amp/')
.expect('Content-Type', /html/)
.expect('Cache-Control', testUtils.cacheRules.public)
.expect(200)
@ -324,7 +324,7 @@ describe('Frontend Routing', function () {
// get today's date
var date = moment().format('YYYY/MM/DD');
request.get('/' + date + '/welcome-to-ghost/amp/')
request.get('/' + date + '/welcome/amp/')
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(404)
.expect(/Page not found/)
@ -339,7 +339,7 @@ describe('Frontend Routing', function () {
return origCache.get(key, options);
});
request.get('/welcome-to-ghost/amp/')
request.get('/welcome/amp/')
.expect(404)
.expect(/Page not found/)
.end(doEnd(done));
@ -592,16 +592,16 @@ describe('Frontend Routing', function () {
.end(doEnd(done));
});
it('http://localhost/blog/welcome-to-ghost should 301 to http://localhost/blog/welcome-to-ghost/', function (done) {
request.get('/blog/welcome-to-ghost')
it('http://localhost/blog/welcome should 301 to http://localhost/blog/welcome/', function (done) {
request.get('/blog/welcome')
.expect(301)
.expect('Location', '/blog/welcome-to-ghost/')
.expect('Location', '/blog/welcome/')
.expect('Cache-Control', testUtils.cacheRules.year)
.end(doEnd(done));
});
it('http://localhost/blog/welcome-to-ghost/ should 200', function (done) {
request.get('/blog/welcome-to-ghost/')
it('http://localhost/blog/welcome/ should 200', function (done) {
request.get('/blog/welcome/')
.expect(200)
.end(doEnd(done));
});
@ -620,8 +620,8 @@ describe('Frontend Routing', function () {
.end(doEnd(done));
});
it('/blog/welcome-to-ghost/amp/ should 200', function (done) {
request.get('/blog/welcome-to-ghost/amp/')
it('/blog/welcome/amp/ should 200', function (done) {
request.get('/blog/welcome/amp/')
.expect(200)
.end(doEnd(done));
});
@ -665,16 +665,16 @@ describe('Frontend Routing', function () {
.end(doEnd(done));
});
it('/blog/welcome-to-ghost should 301 to /blog/welcome-to-ghost/', function (done) {
request.get('/blog/welcome-to-ghost')
it('/blog/welcome should 301 to /blog/welcome/', function (done) {
request.get('/blog/welcome')
.expect(301)
.expect('Location', '/blog/welcome-to-ghost/')
.expect('Location', '/blog/welcome/')
.expect('Cache-Control', testUtils.cacheRules.year)
.end(doEnd(done));
});
it('/blog/welcome-to-ghost/ should 200', function (done) {
request.get('/blog/welcome-to-ghost/')
it('/blog/welcome/ should 200', function (done) {
request.get('/blog/welcome/')
.expect(200)
.end(doEnd(done));
});
@ -693,8 +693,8 @@ describe('Frontend Routing', function () {
.end(doEnd(done));
});
it('/blog/welcome-to-ghost/amp/ should 200', function (done) {
request.get('/blog/welcome-to-ghost/amp/')
it('/blog/welcome/amp/ should 200', function (done) {
request.get('/blog/welcome/amp/')
.expect(200)
.end(doEnd(done));
});

View File

@ -181,8 +181,8 @@ describe('Database Migration (special functions)', function () {
// Post
should.exist(result.posts);
result.posts.length.should.eql(1);
result.posts.at(0).get('title').should.eql('Welcome to Ghost');
result.posts.length.should.eql(7);
result.posts.at(0).get('title').should.eql('Setting up your own Ghost theme');
// Tag
should.exist(result.tags);

View File

@ -106,11 +106,11 @@ describe('Migration Fixture Utils', function () {
fixtureUtils.addFixturesForModel(fixtures.models[0]).then(function (result) {
should.exist(result);
result.should.be.an.Object();
result.should.have.property('expected', 1);
result.should.have.property('done', 1);
result.should.have.property('expected', 7);
result.should.have.property('done', 7);
postOneStub.calledOnce.should.be.true();
postAddStub.calledOnce.should.be.true();
postOneStub.callCount.should.eql(7);
postAddStub.callCount.should.eql(7);
done();
}).catch(done);
@ -122,11 +122,11 @@ describe('Migration Fixture Utils', function () {
fixtureUtils.addFixturesForModel(fixtures.models[0]).then(function (result) {
should.exist(result);
result.should.be.an.Object();
result.should.have.property('expected', 1);
result.should.have.property('expected', 7);
result.should.have.property('done', 0);
postOneStub.calledOnce.should.be.true();
postAddStub.calledOnce.should.be.false();
postOneStub.callCount.should.eql(7);
postAddStub.callCount.should.eql(0);
done();
}).catch(done);
@ -186,18 +186,18 @@ describe('Migration Fixture Utils', function () {
fixtureUtils.addFixturesForRelation(fixtures.relations[1]).then(function (result) {
should.exist(result);
result.should.be.an.Object();
result.should.have.property('expected', 1);
result.should.have.property('done', 1);
result.should.have.property('expected', 7);
result.should.have.property('done', 7);
// Posts & Tags
postsAllStub.calledOnce.should.be.true();
tagsAllStub.calledOnce.should.be.true();
dataMethodStub.filter.calledOnce.should.be.true();
dataMethodStub.find.calledOnce.should.be.true();
fromItem.related.calledOnce.should.be.true();
fromItem.findWhere.calledOnce.should.be.true();
toItem[0].get.calledOnce.should.be.true();
baseUtilAttachStub.callCount.should.eql(1);
dataMethodStub.filter.callCount.should.eql(7);
dataMethodStub.find.callCount.should.eql(7);
fromItem.related.callCount.should.eql(7);
fromItem.findWhere.callCount.should.eql(7);
toItem[0].get.callCount.should.eql(7);
baseUtilAttachStub.callCount.should.eql(7);
done();
}).catch(done);
@ -222,18 +222,18 @@ describe('Migration Fixture Utils', function () {
fixtureUtils.addFixturesForRelation(fixtures.relations[1]).then(function (result) {
should.exist(result);
result.should.be.an.Object();
result.should.have.property('expected', 1);
result.should.have.property('expected', 7);
result.should.have.property('done', 0);
// Posts & Tags
postsAllStub.calledOnce.should.be.true();
tagsAllStub.calledOnce.should.be.true();
dataMethodStub.filter.calledOnce.should.be.true();
dataMethodStub.find.calledOnce.should.be.true();
dataMethodStub.filter.callCount.should.eql(7);
dataMethodStub.find.callCount.should.eql(7);
fromItem.related.calledOnce.should.be.true();
fromItem.findWhere.calledOnce.should.be.true();
toItem[0].get.calledOnce.should.be.true();
fromItem.related.callCount.should.eql(7);
fromItem.findWhere.callCount.should.eql(7);
toItem[0].get.callCount.should.eql(7);
fromItem.tags.called.should.be.false();
fromItem.attach.called.should.be.false();

View File

@ -20,7 +20,7 @@ var should = require('should'), // jshint ignore:line
describe('DB version integrity', function () {
// Only these variables should need updating
var currentSchemaHash = 'b613bca0f20e02360487a3c17a9ffcc1',
currentFixturesHash = 'd9a19655448a168246a4849dc4591ba9';
currentFixturesHash = 'bc9ba1689043b5abd7f7b2d046ac6ff1';
// If this test is failing, then it is likely a change has been made that requires a DB version bump,
// and the values above will need updating as confirmation

View File

@ -264,13 +264,13 @@ describe('Slack', function () {
}).catch(done);
});
it('does not send webhook for \'welcome-to-ghost\' post', function (done) {
it('does not send webhook for \'welcome\' post', function (done) {
// set up
isPostStub.returns(true);
settingsObj.settings[0] = slackObjWithUrl;
// execute code
ping({slug: 'welcome-to-ghost'}).then(function (result) {
ping({slug: 'welcome'}).then(function (result) {
// assertions
isPostStub.calledOnce.should.be.true();
urlForSpy.calledOnce.should.be.true();

View File

@ -71,7 +71,7 @@ describe('XMLRPC', function () {
ping2 = nock('http://rpc.pingomatic.com').post('/').reply(200),
testPost = _.clone(testUtils.DataGenerator.Content.posts[2]);
testPost.slug = 'welcome-to-ghost';
testPost.slug = 'welcome';
ping(testPost);