Current state with 6 failures is considered to be better than the previous one
This commit is contained in:
@@ -163,4 +163,35 @@ describe List do
|
||||
|
||||
describe 'product order creation'
|
||||
end
|
||||
|
||||
describe 'join requests' do
|
||||
describe '#send_table_join_request_for_user' do
|
||||
it "does not add an existing user to join_request_user_ids" do
|
||||
list.send_table_join_request_for_user! user
|
||||
expect(list.join_request_user_ids).not_to include user.id
|
||||
end
|
||||
it "adds a user to join_request_user_ids" do
|
||||
other_user = create :user
|
||||
list.send_table_join_request_for_user! other_user
|
||||
# test through persistance
|
||||
list.reload
|
||||
expect(list.join_request_user_ids).to eq [other_user.id]
|
||||
end
|
||||
|
||||
it "does not add a user multiple times" do
|
||||
other_user = create :user
|
||||
2.times { list.send_table_join_request_for_user! other_user }
|
||||
expect(list.join_request_user_ids).to eq [other_user.id]
|
||||
end
|
||||
|
||||
it "broadcasts it to the user" do
|
||||
other_user = create :user
|
||||
expect{
|
||||
list.send_table_join_request_for_user! other_user
|
||||
}.to broadcast_to_user(user.id).message('user_join_request').with(
|
||||
hash_including(:users, :join_request)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user