49 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| require "test_helper"
 | |
| 
 | |
| class ClientsControllerTest < ActionDispatch::IntegrationTest
 | |
|   setup do
 | |
|     @client = clients(:one)
 | |
|   end
 | |
| 
 | |
|   test "should get index" do
 | |
|     get clients_url
 | |
|     assert_response :success
 | |
|   end
 | |
| 
 | |
|   test "should get new" do
 | |
|     get new_client_url
 | |
|     assert_response :success
 | |
|   end
 | |
| 
 | |
|   test "should create client" do
 | |
|     assert_difference("Client.count") do
 | |
|       post clients_url, params: { client: { city: @client.city, company_name: @client.company_name, country: @client.country, email: @client.email, firstname: @client.firstname, lastname: @client.lastname, phone: @client.phone, streetname: @client.streetname, zipcode: @client.zipcode } }
 | |
|     end
 | |
| 
 | |
|     assert_redirected_to client_url(Client.last)
 | |
|   end
 | |
| 
 | |
|   test "should show client" do
 | |
|     get client_url(@client)
 | |
|     assert_response :success
 | |
|   end
 | |
| 
 | |
|   test "should get edit" do
 | |
|     get edit_client_url(@client)
 | |
|     assert_response :success
 | |
|   end
 | |
| 
 | |
|   test "should update client" do
 | |
|     patch client_url(@client), params: { client: { city: @client.city, company_name: @client.company_name, country: @client.country, email: @client.email, firstname: @client.firstname, lastname: @client.lastname, phone: @client.phone, streetname: @client.streetname, zipcode: @client.zipcode } }
 | |
|     assert_redirected_to client_url(@client)
 | |
|   end
 | |
| 
 | |
|   test "should destroy client" do
 | |
|     assert_difference("Client.count", -1) do
 | |
|       delete client_url(@client)
 | |
|     end
 | |
| 
 | |
|     assert_redirected_to clients_url
 | |
|   end
 | |
| end
 | 
