start writing tests

This commit is contained in:
Josh
2018-05-09 16:31:52 -04:00
parent e6d01ef1b9
commit 5347d902c0
24 changed files with 370 additions and 192 deletions

View File

@ -1,7 +1,39 @@
require 'test_helper'
class RoomTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
def setup
@user = User.new(
name: "Example User",
username: "Username",
provider: "greenlight",
email: "user@example.com",
password: "example",
password_confirmation: "example"
)
@room = Room.new(
user: @user
)
end
test "#owned_by? should identify correct owner." do
assert @room.owned_by?(@user)
end
test "#owned_by? should identify incorrect owner." do
diff_user = User.new(
name: "Different User",
username: "Diffname",
provider: "greenlight",
email: "diff@example.com",
)
assert_not @room.owned_by?(diff_user)
end
test "should set uid on creation." do
@room.save
assert @room.uid
end
end