summaryrefslogtreecommitdiff
path: root/spec/models/issue/metrics_spec.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-10-18 11:47:04 +0000
committerDouwe Maan <douwe@gitlab.com>2016-10-18 11:47:04 +0000
commitb56f093c2ba4739b9d6cec595b8af3ee61a0d12b (patch)
tree94d3189225642dc39b09e189a00edcceecd8d3a6 /spec/models/issue/metrics_spec.rb
parentc9d7ba4d696bfd0198ac75db6e1b2a08b4517f82 (diff)
parentbfb20200e9d1e7edd82a27d18d849ffba043845a (diff)
downloadgitlab-ce-b56f093c2ba4739b9d6cec595b8af3ee61a0d12b.tar.gz
Merge branch 'looser-time-in-specs' into 'master'
Add a be_like_time matcher and use it in specs ## What does this MR do? Introduces a be_like_time matcher and refactors existing code to use it ## Are there points in the code the reviewer needs to double check? A few sites use be_within(2.seconds) or 5.minutes - I didn't change those ## Why was this MR needed? A custom matcher helps to document that we need to compare times loosely, and keeps the fudge factor from being declared in multiple places. ## Screenshots (if relevant) ## Does this MR meet the acceptance criteria? - [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [ ] API support added - Tests - [ ] Added for this feature/bug - [ ] All builds are passing - [ ] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [ ] Branch has no merge conflicts with `master` (if it does - rebase it please) - [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? Related to !6935 See merge request !6936
Diffstat (limited to 'spec/models/issue/metrics_spec.rb')
-rw-r--r--spec/models/issue/metrics_spec.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/models/issue/metrics_spec.rb b/spec/models/issue/metrics_spec.rb
index e170b087ebc..2459a49f095 100644
--- a/spec/models/issue/metrics_spec.rb
+++ b/spec/models/issue/metrics_spec.rb
@@ -13,7 +13,7 @@ describe Issue::Metrics, models: true do
metrics = subject.metrics
expect(metrics).to be_present
- expect(metrics.first_associated_with_milestone_at).to be_within(1.second).of(time)
+ expect(metrics.first_associated_with_milestone_at).to be_like_time(time)
end
it "does not record the second time an issue is associated with a milestone" do
@@ -24,7 +24,7 @@ describe Issue::Metrics, models: true do
metrics = subject.metrics
expect(metrics).to be_present
- expect(metrics.first_associated_with_milestone_at).to be_within(1.second).of(time)
+ expect(metrics.first_associated_with_milestone_at).to be_like_time(time)
end
end
@@ -36,7 +36,7 @@ describe Issue::Metrics, models: true do
metrics = subject.metrics
expect(metrics).to be_present
- expect(metrics.first_added_to_board_at).to be_within(1.second).of(time)
+ expect(metrics.first_added_to_board_at).to be_like_time(time)
end
it "does not record the second time an issue is associated with a list label" do
@@ -48,7 +48,7 @@ describe Issue::Metrics, models: true do
metrics = subject.metrics
expect(metrics).to be_present
- expect(metrics.first_added_to_board_at).to be_within(1.second).of(time)
+ expect(metrics.first_added_to_board_at).to be_like_time(time)
end
end
end