Latest updates

This commit is contained in:
2022-04-07 12:45:09 +01:00
parent 557b43c911
commit 21b42c69a5
25 changed files with 412 additions and 14 deletions

View File

@@ -0,0 +1,48 @@
require "test_helper"
class CafsControllerTest < ActionDispatch::IntegrationTest
setup do
@caf = cafs(:one)
end
test "should get index" do
get cafs_url
assert_response :success
end
test "should get new" do
get new_caf_url
assert_response :success
end
test "should create caf" do
assert_difference("Caf.count") do
post cafs_url, params: { caf: { company_id: @caf.company_id, description: @caf.description, name: @caf.name } }
end
assert_redirected_to caf_url(Caf.last)
end
test "should show caf" do
get caf_url(@caf)
assert_response :success
end
test "should get edit" do
get edit_caf_url(@caf)
assert_response :success
end
test "should update caf" do
patch caf_url(@caf), params: { caf: { company_id: @caf.company_id, description: @caf.description, name: @caf.name } }
assert_redirected_to caf_url(@caf)
end
test "should destroy caf" do
assert_difference("Caf.count", -1) do
delete caf_url(@caf)
end
assert_redirected_to cafs_url
end
end

11
test/fixtures/cafs.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
company: one
name: MyString
description: MyText
two:
company: two
name: MyString
description: MyText

Binary file not shown.

7
test/models/caf_test.rb Normal file
View File

@@ -0,0 +1,7 @@
require "test_helper"
class CafTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

45
test/system/cafs_test.rb Normal file
View File

@@ -0,0 +1,45 @@
require "application_system_test_case"
class CafsTest < ApplicationSystemTestCase
setup do
@caf = cafs(:one)
end
test "visiting the index" do
visit cafs_url
assert_selector "h1", text: "Cafs"
end
test "should create caf" do
visit cafs_url
click_on "New caf"
fill_in "Company", with: @caf.company_id
fill_in "Description", with: @caf.description
fill_in "Name", with: @caf.name
click_on "Create Caf"
assert_text "Caf was successfully created"
click_on "Back"
end
test "should update Caf" do
visit caf_url(@caf)
click_on "Edit this caf", match: :first
fill_in "Company", with: @caf.company_id
fill_in "Description", with: @caf.description
fill_in "Name", with: @caf.name
click_on "Update Caf"
assert_text "Caf was successfully updated"
click_on "Back"
end
test "should destroy Caf" do
visit caf_url(@caf)
click_on "Destroy this caf", match: :first
assert_text "Caf was successfully destroyed"
end
end