characters_test.rb 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. require "application_system_test_case"
  2. class CharactersTest < ApplicationSystemTestCase
  3. setup do
  4. @character = characters(:one)
  5. end
  6. test "visiting the index" do
  7. visit characters_url
  8. assert_selector "h1", text: "Characters"
  9. end
  10. test "creating a Character" do
  11. visit characters_url
  12. click_on "New Character"
  13. fill_in "Agility", with: @character.agility
  14. fill_in "Health", with: @character.health
  15. fill_in "Intelligence", with: @character.intelligence
  16. fill_in "Luck", with: @character.luck
  17. fill_in "Name", with: @character.name
  18. fill_in "Strength", with: @character.strength
  19. click_on "Create Character"
  20. assert_text "Character was successfully created"
  21. click_on "Back"
  22. end
  23. test "updating a Character" do
  24. visit characters_url
  25. click_on "Edit", match: :first
  26. fill_in "Agility", with: @character.agility
  27. fill_in "Health", with: @character.health
  28. fill_in "Intelligence", with: @character.intelligence
  29. fill_in "Luck", with: @character.luck
  30. fill_in "Name", with: @character.name
  31. fill_in "Strength", with: @character.strength
  32. click_on "Update Character"
  33. assert_text "Character was successfully updated"
  34. click_on "Back"
  35. end
  36. test "destroying a Character" do
  37. visit characters_url
  38. page.accept_confirm do
  39. click_on "Destroy", match: :first
  40. end
  41. assert_text "Character was successfully destroyed"
  42. end
  43. end