#435: added specs for Statistic

This commit is contained in:
Vokhmin Alexey V 2014-10-23 00:23:38 +04:00
parent 1184659c19
commit 3d1221ea63
1 changed files with 15 additions and 0 deletions

View File

@ -42,4 +42,19 @@ describe Statistic do
end
end
context '#for_groups' do
it 'returns projects by group ids' do
group1 = FactoryGirl.create(:group)
group2 = FactoryGirl.create(:group)
project1 = FactoryGirl.create(:project, owner: group1)
project2 = FactoryGirl.create(:project, owner: group2)
FactoryGirl.create(:statistic, project: project1)
FactoryGirl.create(:statistic, project: project2)
expect(Statistic.for_groups([group1.id])).to have(1).item
expect(Statistic.for_groups([group1.id, group2])).to have(2).items
end
end
end