Kompanije rade
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: :chrome, screen_size: [1400, 1400]
|
||||
end
|
||||
13
test/channels/application_cable/connection_test.rb
Normal file
13
test/channels/application_cable/connection_test.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
require "test_helper"
|
||||
|
||||
module ApplicationCable
|
||||
class ConnectionTest < ActionCable::Connection::TestCase
|
||||
# test "connects with cookies" do
|
||||
# cookies.signed[:user_id] = 42
|
||||
#
|
||||
# connect
|
||||
#
|
||||
# assert_equal connection.user_id, "42"
|
||||
# end
|
||||
end
|
||||
end
|
||||
0
test/controllers/.keep
Normal file
0
test/controllers/.keep
Normal file
48
test/controllers/companies_controller_test.rb
Normal file
48
test/controllers/companies_controller_test.rb
Normal file
@@ -0,0 +1,48 @@
|
||||
require "test_helper"
|
||||
|
||||
class CompaniesControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@company = companies(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get companies_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_company_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create company" do
|
||||
assert_difference("Company.count") do
|
||||
post companies_url, params: { company: { address_line_one: @company.address_line_one, address_line_two: @company.address_line_two, city: @company.city, country: @company.country, entity: @company.entity, id_number: @company.id_number, name: @company.name, postal_code: @company.postal_code, vat_number: @company.vat_number } }
|
||||
end
|
||||
|
||||
assert_redirected_to company_url(Company.last)
|
||||
end
|
||||
|
||||
test "should show company" do
|
||||
get company_url(@company)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get edit_company_url(@company)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update company" do
|
||||
patch company_url(@company), params: { company: { address_line_one: @company.address_line_one, address_line_two: @company.address_line_two, city: @company.city, country: @company.country, entity: @company.entity, id_number: @company.id_number, name: @company.name, postal_code: @company.postal_code, vat_number: @company.vat_number } }
|
||||
assert_redirected_to company_url(@company)
|
||||
end
|
||||
|
||||
test "should destroy company" do
|
||||
assert_difference("Company.count", -1) do
|
||||
delete company_url(@company)
|
||||
end
|
||||
|
||||
assert_redirected_to companies_url
|
||||
end
|
||||
end
|
||||
23
test/fixtures/companies.yml
vendored
Normal file
23
test/fixtures/companies.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
id_number: MyString
|
||||
vat_number: MyString
|
||||
address_line_one: MyString
|
||||
address_line_two: MyString
|
||||
postal_code: MyString
|
||||
city: MyString
|
||||
entity: MyString
|
||||
country: MyString
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
id_number: MyString
|
||||
vat_number: MyString
|
||||
address_line_one: MyString
|
||||
address_line_two: MyString
|
||||
postal_code: MyString
|
||||
city: MyString
|
||||
entity: MyString
|
||||
country: MyString
|
||||
0
test/fixtures/files/.keep
vendored
Normal file
0
test/fixtures/files/.keep
vendored
Normal file
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/company_test.rb
Normal file
7
test/models/company_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class CompanyTest < 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/companies_test.rb
Normal file
57
test/system/companies_test.rb
Normal file
@@ -0,0 +1,57 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class CompaniesTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@company = companies(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
visit companies_url
|
||||
assert_selector "h1", text: "Companies"
|
||||
end
|
||||
|
||||
test "should create company" do
|
||||
visit companies_url
|
||||
click_on "New company"
|
||||
|
||||
fill_in "Address line one", with: @company.address_line_one
|
||||
fill_in "Address line two", with: @company.address_line_two
|
||||
fill_in "City", with: @company.city
|
||||
fill_in "Country", with: @company.country
|
||||
fill_in "Entity", with: @company.entity
|
||||
fill_in "Id number", with: @company.id_number
|
||||
fill_in "Name", with: @company.name
|
||||
fill_in "Postal code", with: @company.postal_code
|
||||
fill_in "Vat number", with: @company.vat_number
|
||||
click_on "Create Company"
|
||||
|
||||
assert_text "Company was successfully created"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should update Company" do
|
||||
visit company_url(@company)
|
||||
click_on "Edit this company", match: :first
|
||||
|
||||
fill_in "Address line one", with: @company.address_line_one
|
||||
fill_in "Address line two", with: @company.address_line_two
|
||||
fill_in "City", with: @company.city
|
||||
fill_in "Country", with: @company.country
|
||||
fill_in "Entity", with: @company.entity
|
||||
fill_in "Id number", with: @company.id_number
|
||||
fill_in "Name", with: @company.name
|
||||
fill_in "Postal code", with: @company.postal_code
|
||||
fill_in "Vat number", with: @company.vat_number
|
||||
click_on "Update Company"
|
||||
|
||||
assert_text "Company was successfully updated"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should destroy Company" do
|
||||
visit company_url(@company)
|
||||
click_on "Destroy this company", match: :first
|
||||
|
||||
assert_text "Company 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