Commit 1c5141eee908f87ac471163c5c9dfef5eafd05e7
Committed by
Caio
1 parent
4350440e
Exists in
master
and in
28 other branches
[Mezuro] Fixed project client when project doesn't exist in Kalibro. Also fixed …
…functional test not properly mocking content saves.
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
plugins/mezuro/lib/kalibro/client/project_client.rb
| @@ -49,8 +49,8 @@ class Kalibro::Client::ProjectClient | @@ -49,8 +49,8 @@ class Kalibro::Client::ProjectClient | ||
| 49 | begin | 49 | begin |
| 50 | hash = @port.request(:get_project, {:project_name => project_name})[:project] | 50 | hash = @port.request(:get_project, {:project_name => project_name})[:project] |
| 51 | rescue Exception => error | 51 | rescue Exception => error |
| 52 | - if (error.to_s =~ /There is no project named/) != nil | ||
| 53 | - return nil | 52 | + unless (error.message =~ /There is no project named/).nil? |
| 53 | + return nil | ||
| 54 | else | 54 | else |
| 55 | raise error | 55 | raise error |
| 56 | end | 56 | end |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
| @@ -87,7 +87,6 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -87,7 +87,6 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
| 87 | Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) | 87 | Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project) |
| 88 | mock_module_result | 88 | mock_module_result |
| 89 | mock_project_result | 89 | mock_project_result |
| 90 | - | ||
| 91 | get :module_result, :profile => @profile.identifier, :id => @content.id, :date => @project_result.date, :module_name => @name | 90 | get :module_result, :profile => @profile.identifier, :id => @content.id, :date => @project_result.date, :module_name => @name |
| 92 | assert_response 200 | 91 | assert_response 200 |
| 93 | end | 92 | end |
| @@ -114,6 +113,7 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -114,6 +113,7 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
| 114 | def create_project_content | 113 | def create_project_content |
| 115 | @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @name) | 114 | @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @name) |
| 116 | @content.expects(:send_project_to_service).returns(nil) | 115 | @content.expects(:send_project_to_service).returns(nil) |
| 116 | + Kalibro::Client::ProjectClient.expects(:project).raises("there's no project named macaco") | ||
| 117 | @content.save | 117 | @content.save |
| 118 | end | 118 | end |
| 119 | 119 |