@edit_allowed = User.current.allowed_to?(:edit_issues, @project)
@activities = Enumeration::get_values('ACTI')
@priorities = Enumeration::get_values('IPRI')
+ @time_entry = TimeEntry.new
respond_to do |format|
format.html { render :template => 'issues/show.rhtml' }
format.atom { render :action => 'changes', :layout => false, :content_type => 'application/atom+xml' }
validates_numericality_of :hours, :allow_nil => true
validates_length_of :comments, :maximum => 255
+ def after_initialize
+ if new_record?
+ self.activity ||= Enumeration.default('ACTI')
+ end
+ end
+
def before_validation
self.project = issue.project if issue && project.nil?
end
name: Development\r
id: 10\r
opt: ACTI\r
+ is_default: true\r
+enumerations_011: \r
+ name: QA\r
+ id: 11\r
+ opt: ACTI\r
\ No newline at end of file
@response = ActionController::TestResponse.new
end
- def test_create
+ def test_get_edit
+ @request.session[:user_id] = 3
+ get :edit, :project_id => 1
+ assert_response :success
+ assert_template 'edit'
+ # Default activity selected
+ assert_tag :tag => 'option', :attributes => { :selected => 'selected' },
+ :content => 'Development'
+ end
+
+ def test_post_edit
@request.session[:user_id] = 3
post :edit, :project_id => 1,
:time_entry => {:comments => 'Some work on TimelogControllerTest',