time_entry_init.diff

Updated patch with functional test - Jérémie Delaitre, 2010-10-26 19:44

Download (2.14 KB)

View differences:

app/controllers/issues_controller.rb
273 273
    @priorities = IssuePriority.all
274 274
    @edit_allowed = User.current.allowed_to?(:edit_issues, @project)
275 275
    @time_entry = TimeEntry.new
276
    @time_entry.attributes = params[:time_entry]
276 277
    
277 278
    @notes = params[:notes] || (params[:issue].present? ? params[:issue][:notes] : nil)
278 279
    @issue.init_journal(User.current, @notes)
test/functional/issues_controller_test.rb
582 582
    assert_not_nil assigns(:issue)
583 583
    assert_equal Issue.find(1), assigns(:issue)
584 584
  end
585
  
585
 
586 586
  def test_get_edit_with_params
587 587
    @request.session[:user_id] = 2
588
    get :edit, :id => 1, :issue => { :status_id => 5, :priority_id => 7 }
588
    get :edit, :id => 1, :issue => { :status_id => 5, :priority_id => 7 },
589
        :time_entry => { :hours => '2.5', :comments => 'test_get_edit_with_params', :activity_id => TimeEntryActivity.first.id }
589 590
    assert_response :success
590 591
    assert_template 'edit'
591 592
    
......
603 604
                        :child => { :tag => 'option', 
604 605
                                    :content => 'Urgent',
605 606
                                    :attributes => { :selected => 'selected' } }
607

  
608
    assert_tag :input, :attributes => { :name => 'time_entry[hours]', :value => '2.5' }
609
    assert_tag :select, :attributes => { :name => 'time_entry[activity_id]' },
610
                        :child => { :tag => 'option',
611
                                    :value => TimeEntryActivity.first.id,
612
                                    :attributes => { :selected => 'selected' } }
613
    assert_tag :input, :attributes => { :name => 'time_entry[comments]', :value => 'test_get_edit_with_params' }
606 614
  end
607 615

  
608 616
  def test_update_edit_form