fix_filter_values_for_fixed_version_id.patch

Marius BALTEANU, 2017-08-11 16:29

Download (1.55 KB)

View differences:

app/models/time_entry_query.rb
65 65
    add_available_filter("issue.fixed_version_id",
66 66
      :type => :list,
67 67
      :name => l("label_attribute_of_issue", :name => l(:field_fixed_version)),
68
      :values => lambda { fixed_version_values }) if project
68
      :values => lambda { fixed_version_values })
69 69

  
70 70
    add_available_filter("user_id",
71 71
      :type => :list_optional, :values => lambda { author_values }
test/functional/queries_controller_test.rb
581 581
    assert_include ["eCookbook - 2.0", "3", "open"], json
582 582
  end
583 583

  
584
  def test_version_filter_time_entries_with_project_id_should_return_filter_values
585
    @request.session[:user_id] = 2
586
    get :filter, :params => {
587
        :project_id => 1,
588
        :type => 'TimeEntryQuery',
589
        :name => 'issue.fixed_version_id'
590
      }
591

  
592
    assert_response :success
593
    assert_equal 'application/json', response.content_type
594
    json = ActiveSupport::JSON.decode(response.body)
595
    assert_include ["eCookbook - 2.0", "3", "open"], json
596
  end
597

  
584 598
  def test_filter_without_project_id_should_return_filter_values
585 599
    @request.session[:user_id] = 2
586 600
    get :filter, :params => {