Commit c05eb345abd2af40c2fa6b18a61d62ff8d9547e7
Exists in
staging
and in
4 other branches
Merge branch 'rails3_AI3033-serpro_integration' into stable
Showing
3 changed files
with
3 additions
and
38 deletions
Show diff stats
plugins/serpro_integration/Gemfile
plugins/serpro_integration/lib/serpro_integration_plugin/gitlab_integration.rb
plugins/serpro_integration/test/unit/sonar_plugin_test.rb
| 1 | 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' |
| 2 | 2 | |
| 3 | -class RequireAuthToCommentPluginTest < ActiveSupport::TestCase | |
| 4 | - | |
| 5 | - def setup | |
| 6 | - @plugin = RequireAuthToCommentPlugin.new | |
| 7 | - @comment = Comment.new | |
| 8 | - end | |
| 9 | - | |
| 10 | - attr_reader :plugin, :comment | |
| 11 | - | |
| 12 | - should 'reject comments for unauthenticated users' do | |
| 13 | - plugin.context = logged_in(false) | |
| 14 | - plugin.filter_comment(comment) | |
| 15 | - assert comment.rejected? | |
| 16 | - end | |
| 17 | - | |
| 18 | - should 'allow comments from authenticated users' do | |
| 19 | - plugin.context = logged_in(true) | |
| 20 | - plugin.filter_comment(comment) | |
| 21 | - assert !comment.rejected? | |
| 22 | - end | |
| 23 | - | |
| 24 | - should 'allow comments from unauthenticated users if allowed by profile' do | |
| 25 | - plugin.context = logged_in(false) | |
| 26 | - plugin.context.profile.allow_unauthenticated_comments = true | |
| 27 | - | |
| 28 | - plugin.filter_comment(comment) | |
| 29 | - assert !comment.rejected? | |
| 30 | - end | |
| 31 | - | |
| 32 | - protected | |
| 33 | - | |
| 34 | - def logged_in(boolean) | |
| 35 | - controller = mock() | |
| 36 | - controller.stubs(:logged_in?).returns(boolean) | |
| 37 | - controller.stubs(:profile).returns(Profile.new) | |
| 38 | - controller | |
| 39 | - end | |
| 3 | +class SonarPluginTest < ActiveSupport::TestCase | |
| 40 | 4 | |
| 41 | 5 | end | ... | ... |