Commit 1c5141eee908f87ac471163c5c9dfef5eafd05e7

Authored by Renan Teruo + Caio Salgado
Committed by Caio
1 parent 4350440e

[Mezuro] Fixed project client when project doesn't exist in Kalibro. Also fixed …

…functional test not properly mocking content saves.
plugins/mezuro/lib/kalibro/client/project_client.rb
... ... @@ -49,8 +49,8 @@ class Kalibro::Client::ProjectClient
49 49 begin
50 50 hash = @port.request(:get_project, {:project_name => project_name})[:project]
51 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 54 else
55 55 raise error
56 56 end
... ...
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
... ... @@ -87,7 +87,6 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase
87 87 Kalibro::Client::ProjectClient.expects(:project).with(@name).returns(@project)
88 88 mock_module_result
89 89 mock_project_result
90   -
91 90 get :module_result, :profile => @profile.identifier, :id => @content.id, :date => @project_result.date, :module_name => @name
92 91 assert_response 200
93 92 end
... ... @@ -114,6 +113,7 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase
114 113 def create_project_content
115 114 @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @name)
116 115 @content.expects(:send_project_to_service).returns(nil)
  116 + Kalibro::Client::ProjectClient.expects(:project).raises("there's no project named macaco")
117 117 @content.save
118 118 end
119 119  
... ...