diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-10 17:23:19 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-02-10 17:23:19 +0400 |
commit | ec437ad999858db18627174ff1cf9f272e4ddefb (patch) | |
tree | 539759a360783ac321555dcfd1ef53304e259037 /spec | |
parent | 56f989e53e80fe7545a3400ba7ee98a0cd2cf259 (diff) |
Add more tests for FilteringService
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/filtering_service_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/services/filtering_service_spec.rb b/spec/services/filtering_service_spec.rb index 596601264b3..92971d0be12 100644 --- a/spec/services/filtering_service_spec.rb +++ b/spec/services/filtering_service_spec.rb @@ -15,6 +15,7 @@ describe FilteringService do before do project1.team << [user, :master] project2.team << [user, :developer] + project2.team << [user2, :developer] end describe 'merge requests' do @@ -61,5 +62,20 @@ describe FilteringService do issues = FilteringService.new.execute(Issue, user, params) issues.size.should == 1 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 |