add rspec tests

This commit is contained in:
Josh
2018-05-18 11:51:03 -04:00
parent 6cdcd89387
commit f189c98c56
12 changed files with 451 additions and 6 deletions

21
spec/models/room_spec.rb Normal file
View File

@ -0,0 +1,21 @@
require "rails_helper"
describe Room, type: :model do
describe "#owned_by?" do
it "should identify correct owner." do
room = create(:room)
expect(room.owned_by?(room.user)).to eql(true)
end
it "should identify incorrect owner." do
room = create(:room)
expect(room.owned_by?(create(:user))).to eql(false)
end
it "should return false when user is nil." do
room = create(:room)
expect(room.owned_by?(nil)).to eql(false)
end
end
end