Please sign in to comment.
Specify the feature for creating a blog post
We start by writing out an acceptance test for the full feature we want to implement. In this case, we want to visit a blog post creation page, enter a title and body, save it, and then see on the results page that title and body, as well as confirming it’s in the database. Red: No route matches [GET] "/blog_posts/new" The first error we get is that there is no blog-posts/new route.
- Loading branch information...
Showing with 21 additions and 0 deletions.
|@@ -0,0 +1,21 @@|
|describe 'Creating a blog post' do|
|it 'saves and displays the resulting blog post' do|
|fill_in 'Title', with: 'Hello, World!'|
|fill_in 'Body', with: 'Hello, I say!'|
|click_on 'Create Blog Post'|
|expect(page).to have_content('Hello, World!')|
|expect(page).to have_content('Hello, I say!')|
|blog_post = BlogPost.order("id").last|
|expect(blog_post.title).to eq('Hello, World!')|
|expect(blog_post.body).to eq('Hello, I say!')|