Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-08 17:22:43 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-10-08 17:22:43 +0300
commit69bcef32e12cca8a4a31c3035509d479a712b504 (patch)
tree7ff4b1e444ba1ba470f5f2da29f168b3e487c672 /spec/finders
parenta2374758e34475ebdfacbe68b6c5b095b66262ec (diff)
parent4841e883020146fecd386caff7f31f2d9cf307b6 (diff)
Merge remote-tracking branch 'public/trending-projects-performance'
Diffstat (limited to 'spec/finders')
-rw-r--r--spec/finders/trending_projects_finder_spec.rb39
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