initial commit
This commit is contained in:
5
test/application_system_test_case.rb
Normal file
5
test/application_system_test_case.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
require "test_helper"
|
||||
|
||||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
||||
driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
|
||||
end
|
||||
0
test/controllers/.keep
Normal file
0
test/controllers/.keep
Normal file
48
test/controllers/clients_controller_test.rb
Normal file
48
test/controllers/clients_controller_test.rb
Normal file
@@ -0,0 +1,48 @@
|
||||
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
|
||||
48
test/controllers/projects_controller_test.rb
Normal file
48
test/controllers/projects_controller_test.rb
Normal file
@@ -0,0 +1,48 @@
|
||||
require "test_helper"
|
||||
|
||||
class ProjectsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@project = projects(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get projects_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_project_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create project" do
|
||||
assert_difference("Project.count") do
|
||||
post projects_url, params: { project: { name: @project.name } }
|
||||
end
|
||||
|
||||
assert_redirected_to project_url(Project.last)
|
||||
end
|
||||
|
||||
test "should show project" do
|
||||
get project_url(@project)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get edit_project_url(@project)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update project" do
|
||||
patch project_url(@project), params: { project: { name: @project.name } }
|
||||
assert_redirected_to project_url(@project)
|
||||
end
|
||||
|
||||
test "should destroy project" do
|
||||
assert_difference("Project.count", -1) do
|
||||
delete project_url(@project)
|
||||
end
|
||||
|
||||
assert_redirected_to projects_url
|
||||
end
|
||||
end
|
||||
48
test/controllers/subprojects_controller_test.rb
Normal file
48
test/controllers/subprojects_controller_test.rb
Normal file
@@ -0,0 +1,48 @@
|
||||
require "test_helper"
|
||||
|
||||
class SubprojectsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@subproject = subprojects(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get subprojects_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_subproject_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create subproject" do
|
||||
assert_difference("Subproject.count") do
|
||||
post subprojects_url, params: { subproject: { builder_id: @subproject.builder_id, client_id: @subproject.client_id, owner_id: @subproject.owner_id, project_id: @subproject.project_id, subproject_name: @subproject.subproject_name } }
|
||||
end
|
||||
|
||||
assert_redirected_to subproject_url(Subproject.last)
|
||||
end
|
||||
|
||||
test "should show subproject" do
|
||||
get subproject_url(@subproject)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get edit_subproject_url(@subproject)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update subproject" do
|
||||
patch subproject_url(@subproject), params: { subproject: { builder_id: @subproject.builder_id, client_id: @subproject.client_id, owner_id: @subproject.owner_id, project_id: @subproject.project_id, subproject_name: @subproject.subproject_name } }
|
||||
assert_redirected_to subproject_url(@subproject)
|
||||
end
|
||||
|
||||
test "should destroy subproject" do
|
||||
assert_difference("Subproject.count", -1) do
|
||||
delete subproject_url(@subproject)
|
||||
end
|
||||
|
||||
assert_redirected_to subprojects_url
|
||||
end
|
||||
end
|
||||
23
test/fixtures/clients.yml
vendored
Normal file
23
test/fixtures/clients.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
company_name: MyString
|
||||
firstname: MyString
|
||||
lastname: MyString
|
||||
streetname: MyString
|
||||
zipcode: MyString
|
||||
city: MyString
|
||||
country: MyString
|
||||
email: MyString
|
||||
phone: MyString
|
||||
|
||||
two:
|
||||
company_name: MyString
|
||||
firstname: MyString
|
||||
lastname: MyString
|
||||
streetname: MyString
|
||||
zipcode: MyString
|
||||
city: MyString
|
||||
country: MyString
|
||||
email: MyString
|
||||
phone: MyString
|
||||
0
test/fixtures/files/.keep
vendored
Normal file
0
test/fixtures/files/.keep
vendored
Normal file
7
test/fixtures/projects.yml
vendored
Normal file
7
test/fixtures/projects.yml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
15
test/fixtures/subprojects.yml
vendored
Normal file
15
test/fixtures/subprojects.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
subproject_name: MyString
|
||||
project: one
|
||||
client: one
|
||||
owner: one
|
||||
builder: one
|
||||
|
||||
two:
|
||||
subproject_name: MyString
|
||||
project: two
|
||||
client: two
|
||||
owner: two
|
||||
builder: two
|
||||
0
test/helpers/.keep
Normal file
0
test/helpers/.keep
Normal file
0
test/integration/.keep
Normal file
0
test/integration/.keep
Normal file
0
test/mailers/.keep
Normal file
0
test/mailers/.keep
Normal file
0
test/models/.keep
Normal file
0
test/models/.keep
Normal file
7
test/models/client_test.rb
Normal file
7
test/models/client_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class ClientTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
7
test/models/project_test.rb
Normal file
7
test/models/project_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class ProjectTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
7
test/models/subproject_test.rb
Normal file
7
test/models/subproject_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class SubprojectTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
0
test/system/.keep
Normal file
0
test/system/.keep
Normal file
57
test/system/clients_test.rb
Normal file
57
test/system/clients_test.rb
Normal file
@@ -0,0 +1,57 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class ClientsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@client = clients(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
visit clients_url
|
||||
assert_selector "h1", text: "Clients"
|
||||
end
|
||||
|
||||
test "should create client" do
|
||||
visit clients_url
|
||||
click_on "New client"
|
||||
|
||||
fill_in "City", with: @client.city
|
||||
fill_in "Company name", with: @client.company_name
|
||||
fill_in "Country", with: @client.country
|
||||
fill_in "Email", with: @client.email
|
||||
fill_in "Firstname", with: @client.firstname
|
||||
fill_in "Lastname", with: @client.lastname
|
||||
fill_in "Phone", with: @client.phone
|
||||
fill_in "Streetname", with: @client.streetname
|
||||
fill_in "Zipcode", with: @client.zipcode
|
||||
click_on "Create Client"
|
||||
|
||||
assert_text "Client was successfully created"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should update Client" do
|
||||
visit client_url(@client)
|
||||
click_on "Edit this client", match: :first
|
||||
|
||||
fill_in "City", with: @client.city
|
||||
fill_in "Company name", with: @client.company_name
|
||||
fill_in "Country", with: @client.country
|
||||
fill_in "Email", with: @client.email
|
||||
fill_in "Firstname", with: @client.firstname
|
||||
fill_in "Lastname", with: @client.lastname
|
||||
fill_in "Phone", with: @client.phone
|
||||
fill_in "Streetname", with: @client.streetname
|
||||
fill_in "Zipcode", with: @client.zipcode
|
||||
click_on "Update Client"
|
||||
|
||||
assert_text "Client was successfully updated"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should destroy Client" do
|
||||
visit client_url(@client)
|
||||
click_on "Destroy this client", match: :first
|
||||
|
||||
assert_text "Client was successfully destroyed"
|
||||
end
|
||||
end
|
||||
41
test/system/projects_test.rb
Normal file
41
test/system/projects_test.rb
Normal file
@@ -0,0 +1,41 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class ProjectsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@project = projects(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
visit projects_url
|
||||
assert_selector "h1", text: "Projects"
|
||||
end
|
||||
|
||||
test "should create project" do
|
||||
visit projects_url
|
||||
click_on "New project"
|
||||
|
||||
fill_in "Name", with: @project.name
|
||||
click_on "Create Project"
|
||||
|
||||
assert_text "Project was successfully created"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should update Project" do
|
||||
visit project_url(@project)
|
||||
click_on "Edit this project", match: :first
|
||||
|
||||
fill_in "Name", with: @project.name
|
||||
click_on "Update Project"
|
||||
|
||||
assert_text "Project was successfully updated"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should destroy Project" do
|
||||
visit project_url(@project)
|
||||
click_on "Destroy this project", match: :first
|
||||
|
||||
assert_text "Project was successfully destroyed"
|
||||
end
|
||||
end
|
||||
49
test/system/subprojects_test.rb
Normal file
49
test/system/subprojects_test.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class SubprojectsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@subproject = subprojects(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
visit subprojects_url
|
||||
assert_selector "h1", text: "Subprojects"
|
||||
end
|
||||
|
||||
test "should create subproject" do
|
||||
visit subprojects_url
|
||||
click_on "New subproject"
|
||||
|
||||
fill_in "Builder", with: @subproject.builder_id
|
||||
fill_in "Client", with: @subproject.client_id
|
||||
fill_in "Owner", with: @subproject.owner_id
|
||||
fill_in "Project", with: @subproject.project_id
|
||||
fill_in "Subproject name", with: @subproject.subproject_name
|
||||
click_on "Create Subproject"
|
||||
|
||||
assert_text "Subproject was successfully created"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should update Subproject" do
|
||||
visit subproject_url(@subproject)
|
||||
click_on "Edit this subproject", match: :first
|
||||
|
||||
fill_in "Builder", with: @subproject.builder_id
|
||||
fill_in "Client", with: @subproject.client_id
|
||||
fill_in "Owner", with: @subproject.owner_id
|
||||
fill_in "Project", with: @subproject.project_id
|
||||
fill_in "Subproject name", with: @subproject.subproject_name
|
||||
click_on "Update Subproject"
|
||||
|
||||
assert_text "Subproject was successfully updated"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should destroy Subproject" do
|
||||
visit subproject_url(@subproject)
|
||||
click_on "Destroy this subproject", match: :first
|
||||
|
||||
assert_text "Subproject was successfully destroyed"
|
||||
end
|
||||
end
|
||||
15
test/test_helper.rb
Normal file
15
test/test_helper.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
ENV["RAILS_ENV"] ||= "test"
|
||||
require_relative "../config/environment"
|
||||
require "rails/test_help"
|
||||
|
||||
module ActiveSupport
|
||||
class TestCase
|
||||
# Run tests in parallel with specified workers
|
||||
parallelize(workers: :number_of_processors)
|
||||
|
||||
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
||||
fixtures :all
|
||||
|
||||
# Add more helper methods to be used by all tests here...
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user