hubfeenix.fi/test/system/entities_test.rb

48 lines
1.1 KiB
Ruby
Raw Normal View History

2023-01-13 19:50:41 +01:00
require "application_system_test_case"
class EntitiesTest < ApplicationSystemTestCase
setup do
@entity = entities(:one)
end
test "visiting the index" do
visit entities_url
assert_selector "h1", text: "Entities"
end
test "should create entity" do
visit entities_url
click_on "New entity"
fill_in "Ha", with: @entity.ha_id
2023-01-13 20:47:31 +01:00
fill_in "Member", with: @entity.member_id
2023-01-13 19:50:41 +01:00
fill_in "Name", with: @entity.name
fill_in "Type", with: @entity.type
click_on "Create Entity"
assert_text "Entity was successfully created"
click_on "Back"
end
test "should update Entity" do
visit entity_url(@entity)
click_on "Edit this entity", match: :first
fill_in "Ha", with: @entity.ha_id
2023-01-13 20:47:31 +01:00
fill_in "Member", with: @entity.member_id
2023-01-13 19:50:41 +01:00
fill_in "Name", with: @entity.name
fill_in "Type", with: @entity.type
click_on "Update Entity"
assert_text "Entity was successfully updated"
click_on "Back"
end
test "should destroy Entity" do
visit entity_url(@entity)
click_on "Destroy this entity", match: :first
assert_text "Entity was successfully destroyed"
end
end