15855-v2.patch

Takenori TAKAKI, 2021-08-17 10:17

Download (4.25 KB)

View differences:

app/views/issues/index.api.rsb
4 4
      api.id issue.id
5 5
      api.project(:id => issue.project_id, :name => issue.project.name) unless issue.project.nil?
6 6
      api.tracker(:id => issue.tracker_id, :name => issue.tracker.name) unless issue.tracker.nil?
7
      api.status(:id => issue.status_id, :name => issue.status.name) unless issue.status.nil?
7
      api.status(:id => issue.status_id, :name => issue.status.name, :is_closed => issue.status.is_closed) unless issue.status.nil?
8 8
      api.priority(:id => issue.priority_id, :name => issue.priority.name) unless issue.priority.nil?
9 9
      api.author(:id => issue.author_id, :name => issue.author.name) unless issue.author.nil?
10 10
      api.assigned_to(:id => issue.assigned_to_id, :name => issue.assigned_to.name) unless issue.assigned_to.nil?
app/views/issues/show.api.rsb
2 2
  api.id @issue.id
3 3
  api.project(:id => @issue.project_id, :name => @issue.project.name) unless @issue.project.nil?
4 4
  api.tracker(:id => @issue.tracker_id, :name => @issue.tracker.name) unless @issue.tracker.nil?
5
  api.status(:id => @issue.status_id, :name => @issue.status.name) unless @issue.status.nil?
5
  api.status(:id => @issue.status_id, :name => @issue.status.name, :is_closed => @issue.status.is_closed) unless @issue.status.nil?
6 6
  api.priority(:id => @issue.priority_id, :name => @issue.priority.name) unless @issue.priority.nil?
7 7
  api.author(:id => @issue.author_id, :name => @issue.author.name) unless @issue.author.nil?
8 8
  api.assigned_to(:id => @issue.assigned_to_id, :name => @issue.assigned_to.name) unless @issue.assigned_to.nil?
......
80 80

  
81 81
  api.array :allowed_statuses do
82 82
    @allowed_statuses.each do |status|
83
      api.status :id => status.id, :name => status.name
83
      api.status :id => status.id, :name => status.name, :is_closed => status.is_closed
84 84
    end
85 85
  end if include_in_api_response?('allowed_statuses')
86 86
end
test/integration/api_test/issues_test.rb
141 141
    assert_select 'issues>issue>is_private', :text => 'false'
142 142
  end
143 143

  
144
  def test_index_should_include_issue_status_is_closed_false
145
    get '/issues.xml'
146
    assert_select 'issues>issue>status[is_closed=false]'
147
  end
148

  
149
  def test_index_should_include_issue_status_is_closed_true
150
    get '/issues.xml?status_id=5'
151
    assert_select 'issues>issue>status[is_closed=true]'
152
  end
153

  
144 154
  def test_index_should_include_spent_hours
145 155
    Issue.delete_all
146 156
    parent = Issue.generate!(:estimated_hours => 2.0)
......
391 401
  def test_show_should_include_issue_attributes
392 402
    get '/issues/1.xml'
393 403
    assert_select 'issue>is_private', :text => 'false'
404
    assert_select 'issue>status[is_closed=false]'
394 405
  end
395 406

  
396 407
  test "GET /issues/:id.xml?include=watchers should include watchers" do
......
433 444
    assert_response :ok
434 445
    assert_equal 'application/xml', response.media_type
435 446

  
436
    allowed_statuses = [[1, 'New'], [2, 'Assigned'], [4, 'Feedback'], [5, 'Closed'], [6, 'Rejected']]
447
    allowed_statuses = [[1, 'New', 'false'], [2, 'Assigned', 'false'], [4, 'Feedback', 'false'], [5, 'Closed', 'true'], [6, 'Rejected', 'true']]
437 448
    assert_select 'issue allowed_statuses[type=array]' do
438 449
      assert_select 'status', allowed_statuses.length
439 450
      assert_select('status').each_with_index do |status, idx|
440
        id, name, = allowed_statuses[idx]
451
        id, name, is_closed = allowed_statuses[idx]
441 452
        assert_equal id.to_s, status['id']
442 453
        assert_equal name, status['name']
454
        assert_equal is_closed, status['is_closed']
443 455
      end
444 456
    end
445 457
  end