Current state with 6 failures is considered to be better than the previous one

This commit is contained in:
2014-07-31 18:07:06 +02:00
parent 2e7be84a2e
commit c0c25673bf
9 changed files with 50 additions and 13 deletions
+31
View File
@@ -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
@@ -25,7 +25,7 @@ module Matchers
relevant_broadcasts = test_broadcaster.broadcasts.select{|b| b[:channel] =~ /^\/user\/#{@user_id}/ && b[:data][:event] == @message}
@failure_debug_content = "was #{relevant_broadcasts.map{|b| b[:data][:data].inspect}.join(" and ")}"
relevant_broadcasts.any?{|b| b[:data][:data] == @target_object}
relevant_broadcasts.any?{|b| @target_object === b[:data][:data]}
end
def message(msg)