diff --git a/spec/acts_as_messageable_spec.rb b/spec/acts_as_messageable_spec.rb index 3ccaf8b44..351fcb5be 100644 --- a/spec/acts_as_messageable_spec.rb +++ b/spec/acts_as_messageable_spec.rb @@ -150,6 +150,12 @@ expect(@alice.received_messages.count).to eq(1) end + it 'bob should be able to restore message' do + @bob.sent_messages.process(&:delete) + @bob.restore_message(@message.reload) + expect(@bob.sent_messages.count).to eq(1) + end + it 'should works with relation' do @alice.received_messages.process(&:delete) expect(@alice.received_messages.count).to eq(0) @@ -194,6 +200,19 @@ read_datetime = @alice.messages.are_from(@bob).first.updated_at expect(@alice.messages.are_from(@bob).reorder('updated_at asc').first.updated_at).to eq(read_datetime) end + + describe '#open?' do + let(:message) { @alice.messages.are_from(@bob).first } + + it 'returns false for closed message' do + expect(message.open?).to be_falsey + end + + it 'returns true for open message' do + message.read + expect(message.open?).to be_truthy + end + end end it 'finds proper message' do