mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-02-21 20:20:34 +09:00
30 lines
647 B
Ruby
30 lines
647 B
Ruby
require "test_helper"
|
|
|
|
class FirstRunTest < ActiveSupport::TestCase
|
|
setup do
|
|
Account.destroy_all
|
|
Room.destroy_all
|
|
User.destroy_all
|
|
end
|
|
|
|
test "creating makes first user an administrator" do
|
|
user = create_first_run_user
|
|
assert user.administrator?
|
|
end
|
|
|
|
test "first user has access to first room" do
|
|
user = create_first_run_user
|
|
assert user.rooms.one?
|
|
end
|
|
|
|
test "first room is an open room" do
|
|
create_first_run_user
|
|
assert Room.first.open?
|
|
end
|
|
|
|
private
|
|
def create_first_run_user
|
|
FirstRun.create!({ name: "User", email_address: "user@example.com", password: "secret123456" })
|
|
end
|
|
end
|