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
| @@ -46,6 +46,7 @@ class SerproIntegrationPlugin::GitlabIntegration | @@ -46,6 +46,7 @@ class SerproIntegrationPlugin::GitlabIntegration | ||
| 46 | @client.add_group_member(group.id, user.id, 40) | 46 | @client.add_group_member(group.id, user.id, 40) |
| 47 | rescue Gitlab::Error::Conflict => e | 47 | rescue Gitlab::Error::Conflict => e |
| 48 | #already member | 48 | #already member |
| 49 | + Rails.logger.info e.to_s | ||
| 49 | end | 50 | end |
| 50 | user | 51 | user |
| 51 | end | 52 | end |
plugins/serpro_integration/test/unit/sonar_plugin_test.rb
| 1 | require File.dirname(__FILE__) + '/../../../../test/test_helper' | 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 | end | 5 | end |