Skip to content

Commit 74e82eb

Browse files
committed
Add test file for set_read
1 parent 3b059e9 commit 74e82eb

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# frozen_string_literal: true
2+
3+
require 'rails_helper'
4+
5+
RSpec.describe Feedback::SetRead, type: :unit do
6+
let(:feedback) { create(:feedback) }
7+
8+
describe '.call' do
9+
context 'when set_read is successful' do
10+
it 'returns a successful operation response' do
11+
response = described_class.call(feedback: feedback)
12+
expect(response.success?).to be(true)
13+
end
14+
15+
it 'returns the updated feedback' do
16+
response = described_class.call(feedback: feedback)
17+
expect(response[:feedback]).to eq(feedback)
18+
end
19+
20+
it 'returns read_at' do
21+
response = described_class.call(feedback: feedback)
22+
expect(response[:feedback].read_at).to be_present
23+
end
24+
25+
it 'returns read_at as a timestamp' do
26+
response = described_class.call(feedback: feedback)
27+
expect(response[:feedback].read_at).to be_a(ActiveSupport::TimeWithZone)
28+
end
29+
end
30+
end
31+
end

0 commit comments

Comments
 (0)