Merge commit '8ee6cee36e313fcc39763210dfcd3b871b47cacb' into glitch-soc/merge-upstream
This commit is contained in:
commit
3efc857fbc
75 files changed
+1924
-253
No files matched your search
@@ -640,19 +640,6 @@ RSpec.describe Account do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'alphabetic' do
|
||||
it 'sorts by alphabetic order of domain and username' do
|
||||
matches = [
|
||||
{ username: 'a', domain: 'a' },
|
||||
{ username: 'b', domain: 'a' },
|
||||
{ username: 'a', domain: 'b' },
|
||||
{ username: 'b', domain: 'b' },
|
||||
].map(&method(:Fabricate).curry(2).call(:account))
|
||||
|
||||
expect(described_class.without_internal.alphabetic).to eq matches
|
||||
end
|
||||
end
|
||||
|
||||
describe 'matches_display_name' do
|
||||
it 'matches display name which starts with the given string' do
|
||||
match = Fabricate(:account, display_name: 'pattern and suffix')
|
||||
|
||||
@@ -44,22 +44,24 @@ RSpec.describe TermsOfService do
|
||||
end
|
||||
|
||||
describe '.live' do
|
||||
let!(:not_effective) { Fabricate :terms_of_service }
|
||||
# The `pre_effective_date` record captures a period before the value was tracked
|
||||
# The update in the `before` block creates an invalid (but historically plausible) record
|
||||
let!(:pre_effective_date) { travel_to(10.days.ago) { Fabricate :terms_of_service, effective_date: Time.zone.today } }
|
||||
let!(:effective_past) { travel_to(3.days.ago) { Fabricate :terms_of_service, effective_date: Time.zone.today } }
|
||||
let!(:effective_future) { Fabricate :terms_of_service, effective_date: 3.days.from_now }
|
||||
|
||||
before { not_effective.update_attribute(:effective_date, nil) }
|
||||
before { pre_effective_date.update_attribute(:effective_date, nil) }
|
||||
|
||||
it 'returns records without effective or with past effective' do
|
||||
expect(described_class.live)
|
||||
.to include(not_effective)
|
||||
.to include(pre_effective_date)
|
||||
.and include(effective_past)
|
||||
.and not_include(effective_future)
|
||||
end
|
||||
end
|
||||
|
||||
describe '.upcoming' do
|
||||
let!(:unpublished) { Fabricate :terms_of_service, published_at: nil }
|
||||
let!(:unpublished) { Fabricate :terms_of_service, published_at: nil, effective_date: 10.days.from_now }
|
||||
let!(:effective_past) { travel_to(3.days.ago) { Fabricate :terms_of_service, effective_date: Time.zone.today } }
|
||||
let!(:effective_future_near) { Fabricate :terms_of_service, effective_date: 3.days.from_now }
|
||||
let!(:effective_future_far) { Fabricate :terms_of_service, effective_date: 5.days.from_now }
|
||||
|
||||
Reference in new issue
Block a user