Add posts test
This commit is contained in:
parent
0df07c478a
commit
76229c8cc5
17 changed files with 278 additions and 0 deletions
43
test/system/posts_test.rb
Normal file
43
test/system/posts_test.rb
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
require "application_system_test_case"
|
||||
|
||||
class PostsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@post = posts(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
visit posts_url
|
||||
assert_selector "h1", text: "Posts"
|
||||
end
|
||||
|
||||
test "should create post" do
|
||||
visit posts_url
|
||||
click_on "New post"
|
||||
|
||||
fill_in "Body", with: @post.body
|
||||
fill_in "Title", with: @post.title
|
||||
click_on "Create Post"
|
||||
|
||||
assert_text "Post was successfully created"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should update Post" do
|
||||
visit post_url(@post)
|
||||
click_on "Edit this post", match: :first
|
||||
|
||||
fill_in "Body", with: @post.body
|
||||
fill_in "Title", with: @post.title
|
||||
click_on "Update Post"
|
||||
|
||||
assert_text "Post was successfully updated"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should destroy Post" do
|
||||
visit post_url(@post)
|
||||
click_on "Destroy this post", match: :first
|
||||
|
||||
assert_text "Post was successfully destroyed"
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue