Skip to content

Commit

Permalink
Merge pull request #103 from LTe/coverage-increase
Browse files Browse the repository at this point in the history
Increase code coverage for missing cases
  • Loading branch information
LTe committed May 3, 2020
2 parents 6e7acd0 + c41857f commit e4b459d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/acts_as_messageable_spec.rb
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e4b459d

Please sign in to comment.