gitlab-org--gitlab-foss/spec/finders/trending_projects_finder_spec.rb

40 lines
922 B
Ruby
Raw Normal View History

2015-10-06 07:52:11 -04:00
require 'spec_helper'
describe TrendingProjectsFinder do
let(:user) { build(:user) }
2015-10-06 07:52:11 -04:00
describe '#execute' do
describe 'without an explicit start date' do
subject { described_class.new }
2015-10-06 07:52:11 -04:00
it 'returns the trending projects' do
relation = double(:ar_relation)
allow(subject).to receive(:projects_for)
.with(user)
.and_return(relation)
allow(relation).to receive(:trending)
.with(an_instance_of(ActiveSupport::TimeWithZone))
2015-10-06 07:52:11 -04:00
end
end
describe 'with an explicit start date' do
let(:date) { 2.months.ago }
subject { described_class.new }
2015-10-06 07:52:11 -04:00
it 'returns the trending projects' do
relation = double(:ar_relation)
allow(subject).to receive(:projects_for)
.with(user)
.and_return(relation)
2015-10-06 07:52:11 -04:00
allow(relation).to receive(:trending)
.with(date)
2015-10-06 07:52:11 -04:00
end
end
end
end