diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-08 16:22:43 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-08 16:22:43 +0200 |
commit | 69bcef32e12cca8a4a31c3035509d479a712b504 (patch) | |
tree | 7ff4b1e444ba1ba470f5f2da29f168b3e487c672 /spec/finders | |
parent | a2374758e34475ebdfacbe68b6c5b095b66262ec (diff) | |
parent | 4841e883020146fecd386caff7f31f2d9cf307b6 (diff) | |
download | gitlab-ce-69bcef32e12cca8a4a31c3035509d479a712b504.tar.gz |
Merge remote-tracking branch 'public/trending-projects-performance'
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/trending_projects_finder_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/finders/trending_projects_finder_spec.rb b/spec/finders/trending_projects_finder_spec.rb new file mode 100644 index 00000000000..a49cbfd5160 --- /dev/null +++ b/spec/finders/trending_projects_finder_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper' + +describe TrendingProjectsFinder do + let(:user) { build(:user) } + + describe '#execute' do + describe 'without an explicit start date' do + subject { described_class.new } + + 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)) + end + end + + describe 'with an explicit start date' do + let(:date) { 2.months.ago } + + subject { described_class.new } + + 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(date) + end + end + end +end |