diff options
Diffstat (limited to 'spec/finders/error_tracking')
-rw-r--r-- | spec/finders/error_tracking/errors_finder_spec.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/spec/finders/error_tracking/errors_finder_spec.rb b/spec/finders/error_tracking/errors_finder_spec.rb index 2df5f1653e0..29053054f9d 100644 --- a/spec/finders/error_tracking/errors_finder_spec.rb +++ b/spec/finders/error_tracking/errors_finder_spec.rb @@ -6,7 +6,8 @@ RSpec.describe ErrorTracking::ErrorsFinder do let_it_be(:project) { create(:project) } let_it_be(:user) { project.creator } let_it_be(:error) { create(:error_tracking_error, project: project) } - let_it_be(:error_resolved) { create(:error_tracking_error, :resolved, project: project) } + let_it_be(:error_resolved) { create(:error_tracking_error, :resolved, project: project, first_seen_at: 2.hours.ago) } + let_it_be(:error_yesterday) { create(:error_tracking_error, project: project, first_seen_at: Time.zone.now.yesterday) } before do project.add_maintainer(user) @@ -17,12 +18,25 @@ RSpec.describe ErrorTracking::ErrorsFinder do subject { described_class.new(user, project, params).execute } - it { is_expected.to contain_exactly(error, error_resolved) } + it { is_expected.to contain_exactly(error, error_resolved, error_yesterday) } context 'with status parameter' do let(:params) { { status: 'resolved' } } it { is_expected.to contain_exactly(error_resolved) } end + + context 'with sort parameter' do + let(:params) { { status: 'unresolved', sort: 'first_seen' } } + + it { is_expected.to eq([error, error_yesterday]) } + end + + context 'with limit parameter' do + let(:params) { { limit: '1', sort: 'first_seen' } } + + # Sort by first_seen is DESC by default, so the most recent error is `error` + it { is_expected.to contain_exactly(error) } + end end end |