-
-
Save ianks/2a1183e0c1127d3c4640088983c0565f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe Post do | |
let(:api_client) { double(fetch_comments: []) } | |
subject(:post) { Post.new(api_client: api_client) } | |
describe '#comments' do | |
it 'only fetches the approved comments by default' do | |
expect(api_client) | |
.to receive(:fetch_comments) | |
.with(a_hash_including(approved: true)) | |
.once | |
.and_call_original | |
post.comments | |
end | |
it 'only fetches the unread comments by default' do | |
expect(api_client) | |
.to receive(:fetch_comments) | |
.with(a_hash_including(status: :unread)) | |
.once | |
.and_call_original | |
post.comments | |
end | |
# ... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment