-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13918 from saraycp/activity_timeline_component_specs
Add specs for BsRequestActivityTimelineComponent
- Loading branch information
Showing
1 changed file
with
9 additions
and
6 deletions.
There are no files selected for viewing
15 changes: 9 additions & 6 deletions
15
src/api/spec/components/bs_request_activity_timeline_component_spec.rb
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe BsRequestActivityTimelineComponent, type: :component do | ||
context 'when we provide a bs_request' do | ||
it 'shows an element telling who created the request and when' | ||
it 'shows the comments threads' | ||
it 'shows the history elements' | ||
let(:bs_request) { create(:bs_request_with_submit_action) } | ||
let!(:history_element) { create(:history_element_request_accepted, op_object_id: bs_request.id) } | ||
let!(:comment) { create(:comment_request, commentable: bs_request, created_at: Time.zone.yesterday) } | ||
|
||
it 'shows the comment first, as it is an older timeline item' do | ||
expect(render_inline(described_class.new(bs_request: bs_request))).to have_selector('.timeline-item:first-child', text: 'wrote') | ||
expect(render_inline(described_class.new(bs_request: bs_request))).to have_selector('.timeline-item:first-child', text: '1 day ago') | ||
end | ||
|
||
context 'when we do not provide a bs_request' do | ||
it 'raises an error warning the user to provide a request' | ||
it 'shows the history element in the second position, as it is more recent' do | ||
expect(render_inline(described_class.new(bs_request: bs_request))).to have_selector('.timeline-item:last-child', text: 'accepted request') | ||
end | ||
end |