Added 2 tests about passing custom field filter to /issues.xml
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7581 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1de0714fda
commit
a84f877099
|
@ -130,6 +130,34 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
||||||
assert_tag 'errors', :child => {:tag => 'error', :content => "Start date can't be blank"}
|
assert_tag 'errors', :child => {:tag => 'error', :content => "Start date can't be blank"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with custom field filter" do
|
||||||
|
should "show only issues with the custom field value" do
|
||||||
|
get '/issues.xml', { :set_filter => 1, :f => ['cf_1'], :op => {:cf_1 => '='}, :v => {:cf_1 => ['MySQL']}}
|
||||||
|
|
||||||
|
expected_ids = Issue.visible.all(
|
||||||
|
:include => :custom_values,
|
||||||
|
:conditions => {:custom_values => {:custom_field_id => 1, :value => 'MySQL'}}).map(&:id)
|
||||||
|
|
||||||
|
assert_select 'issues > issue > id', :count => expected_ids.count do |ids|
|
||||||
|
ids.each { |id| assert expected_ids.delete(id.children.first.content.to_i) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with custom field filter (shorthand method)" do
|
||||||
|
should "show only issues with the custom field value" do
|
||||||
|
get '/issues.xml', { :cf_1 => 'MySQL' }
|
||||||
|
|
||||||
|
expected_ids = Issue.visible.all(
|
||||||
|
:include => :custom_values,
|
||||||
|
:conditions => {:custom_values => {:custom_field_id => 1, :value => 'MySQL'}}).map(&:id)
|
||||||
|
|
||||||
|
assert_select 'issues > issue > id', :count => expected_ids.count do |ids|
|
||||||
|
ids.each { |id| assert expected_ids.delete(id.children.first.content.to_i) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "/index.json" do
|
context "/index.json" do
|
||||||
|
@ -139,9 +167,12 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
|
||||||
context "/index.xml with filter" do
|
context "/index.xml with filter" do
|
||||||
should "show only issues with the status_id" do
|
should "show only issues with the status_id" do
|
||||||
get '/issues.xml?status_id=5'
|
get '/issues.xml?status_id=5'
|
||||||
assert_tag :tag => 'issues',
|
|
||||||
:children => { :count => Issue.visible.count(:conditions => {:status_id => 5}),
|
expected_ids = Issue.visible.all(:conditions => {:status_id => 5}).map(&:id)
|
||||||
:only => { :tag => 'issue' } }
|
|
||||||
|
assert_select 'issues > issue > id', :count => expected_ids.count do |ids|
|
||||||
|
ids.each { |id| assert expected_ids.delete(id.children.first.content.to_i) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue