Add support for FASP data sharing (#34415)
This commit is contained in:
parent
3ea1f074ab
commit
a5a2c6dc7e
38 changed files with 1140 additions and 1 deletions
33
spec/models/fasp/subscription_spec.rb
Normal file
33
spec/models/fasp/subscription_spec.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Fasp::Subscription do
|
||||
describe '#threshold=' do
|
||||
subject { described_class.new }
|
||||
|
||||
it 'allows setting all threshold values at once' do
|
||||
subject.threshold = {
|
||||
'timeframe' => 30,
|
||||
'shares' => 5,
|
||||
'likes' => 8,
|
||||
'replies' => 7,
|
||||
}
|
||||
|
||||
expect(subject.threshold_timeframe).to eq 30
|
||||
expect(subject.threshold_shares).to eq 5
|
||||
expect(subject.threshold_likes).to eq 8
|
||||
expect(subject.threshold_replies).to eq 7
|
||||
end
|
||||
end
|
||||
|
||||
describe '#timeframe_start' do
|
||||
subject { described_class.new(threshold_timeframe: 45) }
|
||||
|
||||
it 'returns a Time representing the beginning of the timeframe' do
|
||||
travel_to Time.zone.local(2025, 4, 7, 16, 40) do
|
||||
expect(subject.timeframe_start).to eq Time.zone.local(2025, 4, 7, 15, 55)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue