mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-02-21 20:20:34 +09:00
34 lines
822 B
Ruby
34 lines
822 B
Ruby
require "test_helper"
|
|
|
|
class FirstRunsControllerTest < ActionDispatch::IntegrationTest
|
|
setup do
|
|
Account.destroy_all
|
|
User.destroy_all
|
|
Room.destroy_all
|
|
end
|
|
|
|
test "new is permitted when no other users exit" do
|
|
get first_run_url
|
|
assert_response :success
|
|
end
|
|
|
|
test "new is not permitted when account exist" do
|
|
Account.create!(name: "Chat")
|
|
|
|
get first_run_url
|
|
assert_redirected_to root_url
|
|
end
|
|
|
|
test "create" do
|
|
assert_difference -> { Room.count }, 1 do
|
|
assert_difference -> { User.count }, 1 do
|
|
post first_run_url, params: { account: { name: "37signals" }, user: { name: "New Person", email_address: "new@37signals.com", password: "secret123456" } }
|
|
end
|
|
end
|
|
|
|
assert_redirected_to root_url
|
|
|
|
assert parsed_cookies.signed[:session_token]
|
|
end
|
|
end
|