BigW Consortium Gitlab

Add more tests for FilteringService

parent 56f989e5
...@@ -15,6 +15,7 @@ describe FilteringService do ...@@ -15,6 +15,7 @@ describe FilteringService do
before do before do
project1.team << [user, :master] project1.team << [user, :master]
project2.team << [user, :developer] project2.team << [user, :developer]
project2.team << [user2, :developer]
end end
describe 'merge requests' do describe 'merge requests' do
...@@ -61,5 +62,20 @@ describe FilteringService do ...@@ -61,5 +62,20 @@ describe FilteringService do
issues = FilteringService.new.execute(Issue, user, params) issues = FilteringService.new.execute(Issue, user, params)
issues.size.should == 1 issues.size.should == 1
end end
it 'should be empty for unauthorized user' do
params = { scope: "all", state: 'opened' }
issues = FilteringService.new.execute(Issue, nil, params)
issues.size.should be_zero
end
it 'should not include unauthorized issues' do
params = { scope: "all", state: 'opened' }
issues = FilteringService.new.execute(Issue, user2, params)
issues.size.should == 2
issues.should_not include(issue1)
issues.should include(issue2)
issues.should include(issue3)
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment