added the last two models
This commit is contained in:
48
test/controllers/credentials_controller_test.rb
Normal file
48
test/controllers/credentials_controller_test.rb
Normal file
@@ -0,0 +1,48 @@
|
||||
require "test_helper"
|
||||
|
||||
class CredentialsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@credential = credentials(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get credentials_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_credential_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create credential" do
|
||||
assert_difference("Credential.count") do
|
||||
post credentials_url, params: { credential: { email: @credential.email, password: @credential.password } }
|
||||
end
|
||||
|
||||
assert_redirected_to credential_url(Credential.last)
|
||||
end
|
||||
|
||||
test "should show credential" do
|
||||
get credential_url(@credential)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get edit_credential_url(@credential)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update credential" do
|
||||
patch credential_url(@credential), params: { credential: { email: @credential.email, password: @credential.password } }
|
||||
assert_redirected_to credential_url(@credential)
|
||||
end
|
||||
|
||||
test "should destroy credential" do
|
||||
assert_difference("Credential.count", -1) do
|
||||
delete credential_url(@credential)
|
||||
end
|
||||
|
||||
assert_redirected_to credentials_url
|
||||
end
|
||||
end
|
||||
9
test/fixtures/credentials.yml
vendored
Normal file
9
test/fixtures/credentials.yml
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
email: MyString
|
||||
password: MyString
|
||||
|
||||
two:
|
||||
email: MyString
|
||||
password: MyString
|
||||
8
test/fixtures/virtuals.yml
vendored
8
test/fixtures/virtuals.yml
vendored
@@ -1,9 +1,9 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
email: MyString
|
||||
destination: MyString
|
||||
email: abuse@example.net
|
||||
destination: bob@example.net
|
||||
|
||||
two:
|
||||
email: MyString
|
||||
destination: MyString
|
||||
email: postmaster@example.net
|
||||
destination: bob@example.net
|
||||
|
||||
BIN
test/models/.virtual_test.rb.kate-swp
Normal file
BIN
test/models/.virtual_test.rb.kate-swp
Normal file
Binary file not shown.
7
test/models/credential_test.rb
Normal file
7
test/models/credential_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class CredentialTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
43
test/system/credentials_test.rb
Normal file
43
test/system/credentials_test.rb
Normal file
@@ -0,0 +1,43 @@
|
||||
require "application_system_test_case"
|
||||
|
||||
class CredentialsTest < ApplicationSystemTestCase
|
||||
setup do
|
||||
@credential = credentials(:one)
|
||||
end
|
||||
|
||||
test "visiting the index" do
|
||||
visit credentials_url
|
||||
assert_selector "h1", text: "Credentials"
|
||||
end
|
||||
|
||||
test "should create credential" do
|
||||
visit credentials_url
|
||||
click_on "New credential"
|
||||
|
||||
fill_in "Email", with: @credential.email
|
||||
fill_in "Password", with: @credential.password
|
||||
click_on "Create Credential"
|
||||
|
||||
assert_text "Credential was successfully created"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should update Credential" do
|
||||
visit credential_url(@credential)
|
||||
click_on "Edit this credential", match: :first
|
||||
|
||||
fill_in "Email", with: @credential.email
|
||||
fill_in "Password", with: @credential.password
|
||||
click_on "Update Credential"
|
||||
|
||||
assert_text "Credential was successfully updated"
|
||||
click_on "Back"
|
||||
end
|
||||
|
||||
test "should destroy Credential" do
|
||||
visit credential_url(@credential)
|
||||
click_on "Destroy this credential", match: :first
|
||||
|
||||
assert_text "Credential was successfully destroyed"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user