summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/models/concerns/issuable_spec.rb2
-rw-r--r--spec/models/issue_spec.rb4
-rw-r--r--spec/models/merge_request_spec.rb4
-rw-r--r--spec/models/note_spec.rb2
-rw-r--r--spec/support/shared_examples/throttled_touch.rb20
5 files changed, 2 insertions, 30 deletions
diff --git a/spec/models/concerns/issuable_spec.rb b/spec/models/concerns/issuable_spec.rb
index 9df26f06a11..a53b59c4e08 100644
--- a/spec/models/concerns/issuable_spec.rb
+++ b/spec/models/concerns/issuable_spec.rb
@@ -171,7 +171,7 @@ describe Issuable do
it "returns false when record has been updated" do
allow(issue).to receive(:today?).and_return(true)
- issue.update_attribute(:updated_at, 1.hour.ago)
+ issue.touch
expect(issue.new?).to be_falsey
end
end
diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb
index 0ea287d007a..5f901262598 100644
--- a/spec/models/issue_spec.rb
+++ b/spec/models/issue_spec.rb
@@ -765,8 +765,4 @@ describe Issue do
expect(described_class.public_only).to eq([public_issue])
end
end
-
- it_behaves_like 'throttled touch' do
- subject { create(:issue, updated_at: 1.hour.ago) }
- end
end
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 30a5a3bbff7..81eb62f1801 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -1851,8 +1851,4 @@ describe MergeRequest do
.to change { project.open_merge_requests_count }.from(1).to(0)
end
end
-
- it_behaves_like 'throttled touch' do
- subject { create(:merge_request, updated_at: 1.hour.ago) }
- end
end
diff --git a/spec/models/note_spec.rb b/spec/models/note_spec.rb
index e1a0c55b6a6..6e7e8c4c570 100644
--- a/spec/models/note_spec.rb
+++ b/spec/models/note_spec.rb
@@ -5,7 +5,7 @@ describe Note do
describe 'associations' do
it { is_expected.to belong_to(:project) }
- it { is_expected.to belong_to(:noteable).touch(false) }
+ it { is_expected.to belong_to(:noteable).touch(true) }
it { is_expected.to belong_to(:author).class_name('User') }
it { is_expected.to have_many(:todos).dependent(:destroy) }
diff --git a/spec/support/shared_examples/throttled_touch.rb b/spec/support/shared_examples/throttled_touch.rb
deleted file mode 100644
index 4a25bb9b750..00000000000
--- a/spec/support/shared_examples/throttled_touch.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-shared_examples_for 'throttled touch' do
- describe '#touch' do
- it 'updates the updated_at timestamp' do
- Timecop.freeze do
- subject.touch
- expect(subject.updated_at).to eq(Time.zone.now)
- end
- end
-
- it 'updates the object at most once per minute' do
- first_updated_at = Time.zone.now - (ThrottledTouch::TOUCH_INTERVAL * 2)
- second_updated_at = Time.zone.now - (ThrottledTouch::TOUCH_INTERVAL * 1.5)
-
- Timecop.freeze(first_updated_at) { subject.touch }
- Timecop.freeze(second_updated_at) { subject.touch }
-
- expect(subject.updated_at).to eq(first_updated_at)
- end
- end
-end