2023-09-17 13:59:06 +00:00
|
|
|
require "test_helper"
|
|
|
|
|
|
|
|
class MicropostsControllerTest < ActionDispatch::IntegrationTest
|
|
|
|
test "should get new" do
|
|
|
|
sign_in(users(:user))
|
2023-10-13 15:49:33 +00:00
|
|
|
get new_micropost_url
|
2023-09-17 13:59:06 +00:00
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should create" do
|
|
|
|
post_content = "<p>Just some text</p>"
|
|
|
|
sign_in(users(:user))
|
2023-10-13 15:49:33 +00:00
|
|
|
post microposts_url, params: { micropost: { content: post_content } }
|
2023-09-17 13:59:06 +00:00
|
|
|
assert_response :redirect
|
|
|
|
follow_redirect!
|
|
|
|
assert_includes @response.body, post_content
|
|
|
|
end
|
|
|
|
end
|