diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-10-15 11:26:58 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-10-15 11:26:58 +0200 |
commit | 95f0440a7823a927ebba1557b091c12255e49ac4 (patch) | |
tree | fa6d130f2baff18e7a70d74dafe79e20da35babe /spec/finders/trending_projects_finder_spec.rb | |
parent | 4a5b77188ec7525d1c3a1ee925c8791f841b040c (diff) | |
parent | 123669a55107514798ba531ba3a744b3ec8503ee (diff) | |
download | gitlab-ce-95f0440a7823a927ebba1557b091c12255e49ac4.tar.gz |
Merge branch 'master' into rs-redactor-filter
Diffstat (limited to 'spec/finders/trending_projects_finder_spec.rb')
-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 |