scaffold accounts
This commit is contained in:
58
test/controllers/accounts_controller_test.rb
Normal file
58
test/controllers/accounts_controller_test.rb
Normal file
@@ -0,0 +1,58 @@
|
||||
require 'test_helper'
|
||||
|
||||
class AccountsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@account = accounts(:client1)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get accounts_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_account_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create account" do
|
||||
assert_difference('Account.count') do
|
||||
post accounts_url, params: { account: {
|
||||
home: @account.home,
|
||||
password: @account.password,
|
||||
site: @account.site,
|
||||
username: 'client-new'
|
||||
} }
|
||||
end
|
||||
|
||||
assert_redirected_to account_url(Account.last)
|
||||
end
|
||||
|
||||
test "should show account" do
|
||||
get account_url(@account)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get edit_account_url(@account)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update account" do
|
||||
patch account_url(@account), params: { account: {
|
||||
home: @account.home,
|
||||
password: @account.password,
|
||||
site: @account.site,
|
||||
username: @account.username
|
||||
} }
|
||||
assert_redirected_to account_url(@account)
|
||||
end
|
||||
|
||||
test "should destroy account" do
|
||||
assert_difference('Account.count', -1) do
|
||||
delete account_url(@account)
|
||||
end
|
||||
|
||||
assert_redirected_to accounts_url
|
||||
end
|
||||
end
|
13
test/fixtures/accounts.yml
vendored
Normal file
13
test/fixtures/accounts.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
client1:
|
||||
username: client-one
|
||||
password: 1q2w3e4r5t6y7u
|
||||
home: client_one
|
||||
site: dev
|
||||
|
||||
cleint2:
|
||||
username: client-two
|
||||
password: lokjnmjht75erfhj
|
||||
home: client_two
|
||||
site: dev
|
7
test/models/account_test.rb
Normal file
7
test/models/account_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require 'test_helper'
|
||||
|
||||
class AccountTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Reference in New Issue
Block a user