Sha256: ab5a11c92a0f2fe57e5d475fc64ef72bb757ddc4d18ca53fbf97eb26a2b3bf77
Contents?: true
Size: 1.82 KB
Versions: 3
Compression:
Stored size: 1.82 KB
Contents
# frozen_string_literal: true require 'application_system_test_case' class CommentsTest < ApplicationSystemTestCase setup do visit root_path end test 'a message is shown when there are no Comments' do click_on 'Lorem Barnak' assert_text 'There are no Comments just yet.' end test 'guest can see existing Comment' do click_on 'The Hobbit' assert_text 'existing@example.com says:' assert_text 'I hate everything about this article.' end test 'Comment can be created' do sign_in click_on 'The Hobbit' click_on 'Create Comment' fill_in 'Body', with: 'My long comment' click_on 'Create' assert_title 'The Hobbit' assert_text 'existing@example.com says:' assert_text 'My long comment' end test 'validation errors are shown' do sign_in click_on 'The Hobbit' click_on 'Create Comment' fill_in 'Body', with: 'Short' click_on 'Create' assert_title 'New Comment' assert_field 'Body', with: 'Short' assert_text 'Body is too short (minimum is 10 characters)' end test 'guest cannot see the Create Comment link' do click_on 'The Hobbit' assert_no_link 'Create Comment' end test 'Comment can be deleted' do sign_in click_on 'The Hobbit' within('.comments') do click_on 'Delete' end assert_title 'The Hobbit' assert_text 'Comment was successfully destroyed' assert_text 'There are no Comments just yet.' end test 'guest cannot see the delete button' do click_on 'The Hobbit' within('.comments') do assert_no_button 'Delete' end end test 'User who is not the author of the comment cannot see the delete button' do sign_in(email: 'jrr_tolkien@example.com', password: 'abc345') click_on 'The Hobbit' within('.comments') do assert_no_button 'Delete' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
upgrow-0.0.5 | test/system/comments_test.rb |
upgrow-0.0.4 | test/system/comments_test.rb |
upgrow-0.0.3 | test/system/comments_test.rb |