Commit e595da65f91438f3f5f60c5cb05e877fca9b012d

Authored by Diego Camarinha
Committed by Diego Camarinha
1 parent 7c444dce

[Mezuro] Fixed some bugs

plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb
@@ -22,7 +22,7 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController @@ -22,7 +22,7 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController
22 22
23 if( repository.errors.empty? ) 23 if( repository.errors.empty? )
24 repository.process 24 repository.process
25 - redirect_to "/profile/#{profile.identifier}/plugin/mezuro/repository/show/#{project_content.id}?repository_id=#{project_content.id}" 25 + redirect_to "/profile/#{profile.identifier}/plugin/mezuro/repository/show/#{project_content.id}?repository_id=#{repository.id}"
26 else 26 else
27 redirect_to_error_page repository.errors[0].message 27 redirect_to_error_page repository.errors[0].message
28 end 28 end
@@ -47,9 +47,9 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController @@ -47,9 +47,9 @@ class MezuroPluginRepositoryController < MezuroPluginProfileController
47 47
48 repository = Kalibro::Repository.new( params[:repository] ) 48 repository = Kalibro::Repository.new( params[:repository] )
49 repository.save(project_content.project_id) 49 repository.save(project_content.project_id)
50 - 50 +
51 if( repository.errors.empty? ) 51 if( repository.errors.empty? )
52 - redirect_to "/profile/#{profile.identifier}/plugin/mezuro/repository/show/#{project_content.id}?repository_id=#{project_content.id}" 52 + redirect_to "/profile/#{profile.identifier}/plugin/mezuro/repository/show/#{project_content.id}?repository_id=#{repository.id}"
53 else 53 else
54 redirect_to_error_page repository.errors[0].message 54 redirect_to_error_page repository.errors[0].message
55 end 55 end
plugins/mezuro/lib/kalibro/range_snapshot.rb
1 class Kalibro::RangeSnapshot < Kalibro::Model 1 class Kalibro::RangeSnapshot < Kalibro::Model
2 2
3 - attr_accessor :end, :label, :grade, :color, :comments 3 + attr_accessor :beginning, :end, :label, :grade, :color, :comments
4 4
5 end 5 end
plugins/mezuro/test/functional/profile/mezuro_plugin_processing_controller_test.rb
@@ -19,8 +19,15 @@ class MezuroPluginProcessingControllerTest &lt; ActionController::TestCase @@ -19,8 +19,15 @@ class MezuroPluginProcessingControllerTest &lt; ActionController::TestCase
19 end 19 end
20 20
21 should 'render last processing state' do 21 should 'render last processing state' do
22 - Kalibro::Processing.expects(:request).with(:last_processing_state, :repository_id => @repository_id).returns({:process_state => @processing.state})  
23 - get :render_last_state, :profile => @profile.identifier, :repository_id => @repository_id 22 + Kalibro::Processing.expects(:processing_of).with(@repository_id).returns(@processing)
  23 + get :state, :profile => @profile.identifier, :repository_id => @repository_id
  24 + assert_response 200
  25 + assert_equal @processing.state, @response.body
  26 + end
  27 +
  28 + should 'render a processing state in a specific date' do
  29 + Kalibro::Processing.expects(:processing_with_date_of).with(@repository_id, @processing.date).returns(@processing)
  30 + get :state, :profile => @profile.identifier, :repository_id => @repository_id, :date => @processing.date
24 assert_response 200 31 assert_response 200
25 assert_equal @processing.state, @response.body 32 assert_equal @processing.state, @response.body
26 end 33 end