@@ -21,6 +21,7 api.array :custom_fields do | |||
|
21 | 21 | values.each do |label, value| |
|
22 | 22 | api.possible_value do |
|
23 | 23 | api.value value || label |
|
24 | api.label label | |
|
24 | 25 | end |
|
25 | 26 | end |
|
26 | 27 | end |
@@ -32,10 +32,25 class Redmine::ApiTest::CustomFieldsTest < Redmine::ApiTest::Base | |||
|
32 | 32 | assert_select 'customized_type', :text => 'issue' |
|
33 | 33 | assert_select 'possible_values[type=array]' do |
|
34 | 34 | assert_select 'possible_value>value', :text => 'PostgreSQL' |
|
35 | assert_select 'possible_value>label', :text => 'PostgreSQL' | |
|
35 | 36 | end |
|
36 | 37 | assert_select 'trackers[type=array]' |
|
37 | 38 | assert_select 'roles[type=array]' |
|
38 | 39 | end |
|
39 | 40 | end |
|
40 | 41 | end |
|
42 | ||
|
43 | test "GET /custom_fields.xml should include value and label for enumeration custom fields" do | |
|
44 | field = IssueCustomField.generate!(:field_format => 'enumeration') | |
|
45 | foo = field.enumerations.create!(:name => 'Foo') | |
|
46 | bar = field.enumerations.create!(:name => 'Bar') | |
|
47 | ||
|
48 | get '/custom_fields.xml', {}, credentials('admin') | |
|
49 | assert_response :success | |
|
50 | ||
|
51 | assert_select 'possible_value' do | |
|
52 | assert_select "value:contains(?) + label:contains(?)", foo.id.to_s, 'Foo' | |
|
53 | assert_select "value:contains(?) + label:contains(?)", bar.id.to_s, 'Bar' | |
|
54 | end | |
|
55 | end | |
|
41 | 56 | end |
General Comments 0
You need to be logged in to leave comments.
Login now