Added doamins

This commit is contained in:
2023-05-10 14:29:15 +01:00
parent 1b08798306
commit 843b510395
22 changed files with 304 additions and 5 deletions

View File

@@ -0,0 +1,48 @@
require "test_helper"
class DomainsControllerTest < ActionDispatch::IntegrationTest
setup do
@domain = domains(:one)
end
test "should get index" do
get domains_url
assert_response :success
end
test "should get new" do
get new_domain_url
assert_response :success
end
test "should create domain" do
assert_difference("Domain.count") do
post domains_url, params: { domain: { domain: @domain.domain } }
end
assert_redirected_to domain_url(Domain.last)
end
test "should show domain" do
get domain_url(@domain)
assert_response :success
end
test "should get edit" do
get edit_domain_url(@domain)
assert_response :success
end
test "should update domain" do
patch domain_url(@domain), params: { domain: { domain: @domain.domain } }
assert_redirected_to domain_url(@domain)
end
test "should destroy domain" do
assert_difference("Domain.count", -1) do
delete domain_url(@domain)
end
assert_redirected_to domains_url
end
end

7
test/fixtures/domains.yml vendored Normal file
View File

@@ -0,0 +1,7 @@
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
one:
domain: MyString
two:
domain: MyString

View File

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

View File

@@ -0,0 +1,41 @@
require "application_system_test_case"
class DomainsTest < ApplicationSystemTestCase
setup do
@domain = domains(:one)
end
test "visiting the index" do
visit domains_url
assert_selector "h1", text: "Domains"
end
test "should create domain" do
visit domains_url
click_on "New domain"
fill_in "Domain", with: @domain.domain
click_on "Create Domain"
assert_text "Domain was successfully created"
click_on "Back"
end
test "should update Domain" do
visit domain_url(@domain)
click_on "Edit this domain", match: :first
fill_in "Domain", with: @domain.domain
click_on "Update Domain"
assert_text "Domain was successfully updated"
click_on "Back"
end
test "should destroy Domain" do
visit domain_url(@domain)
click_on "Destroy this domain", match: :first
assert_text "Domain was successfully destroyed"
end
end