Commit ec437ad999858db18627174ff1cf9f272e4ddefb
1 parent
56f989e5
Exists in
spb-stable
and in
3 other branches
Add more tests for FilteringService
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
16 additions
and
0 deletions
Show diff stats
spec/services/filtering_service_spec.rb
... | ... | @@ -15,6 +15,7 @@ describe FilteringService do |
15 | 15 | before do |
16 | 16 | project1.team << [user, :master] |
17 | 17 | project2.team << [user, :developer] |
18 | + project2.team << [user2, :developer] | |
18 | 19 | end |
19 | 20 | |
20 | 21 | describe 'merge requests' do |
... | ... | @@ -61,5 +62,20 @@ describe FilteringService do |
61 | 62 | issues = FilteringService.new.execute(Issue, user, params) |
62 | 63 | issues.size.should == 1 |
63 | 64 | end |
65 | + | |
66 | + it 'should be empty for unauthorized user' do | |
67 | + params = { scope: "all", state: 'opened' } | |
68 | + issues = FilteringService.new.execute(Issue, nil, params) | |
69 | + issues.size.should be_zero | |
70 | + end | |
71 | + | |
72 | + it 'should not include unauthorized issues' do | |
73 | + params = { scope: "all", state: 'opened' } | |
74 | + issues = FilteringService.new.execute(Issue, user2, params) | |
75 | + issues.size.should == 2 | |
76 | + issues.should_not include(issue1) | |
77 | + issues.should include(issue2) | |
78 | + issues.should include(issue3) | |
79 | + end | |
64 | 80 | end |
65 | 81 | end | ... | ... |