Permalink
Browse files

fix: execution of queries with grouped columns

  • Loading branch information...
Sven Krzyzak
Sven Krzyzak committed Feb 9, 2011
1 parent 672bb30 commit cab8d5fd358fa915375c083ccc40375b7b90d544
Showing with 34 additions and 12 deletions.
  1. +1 −1 app/controllers/mylyn_connector/issues_controller.rb
  2. +33 −11 test/functional/issues_controller_test.rb
@@ -31,7 +31,7 @@ def index
retrieve_query
if @query.valid?
- @issues = @query.issues
+ @issues = @query.issues(:include=>[:assigned_to, :tracker, :priority, :category, :fixed_version])
respond_to do |format|
format.xml {render :layout => false}
@@ -170,21 +170,43 @@ def test_show_404
assert_response 404
end
-# def test_query_by_id
-# get :query, :project_id => 1, :query_id => 1
-#
-# assert_response :success
-# assert_template 'index.rxml'
-#
+ def test_query_by_id
+ get :index, :project_id => 1, :query_id => 1
+
+ assert_response :success
+ assert_template 'index.xml.builder'
+
+ #TODO create a schema
# xmldoc = XML::Document.string @response.body
# schema = read_schema 'issues'
# valid = xmldoc.validate_schema schema
# assert valid , 'Ergenis passt nicht zum Schema ' + 'issues'
-#
-# assert_tag :tag => 'issues', :children => {:count => 1}
-# assert_tag :tag => 'issue', :attributes => {:id => 3}
-# end
-#
+
+ assert_tag :tag => 'issues', :children => {:count => 1}
+ assert_tag :tag => 'issue', :attributes => {:id => 3}
+ end
+
+ def test_grouped_query_by_id
+ get :index, :query_id => 6
+
+ assert_response :success
+ assert_template 'index.xml.builder'
+
+ #TODO create a schema
+# xmldoc = XML::Document.string @response.body
+# schema = read_schema 'issues'
+# valid = xmldoc.validate_schema schema
+# assert valid , 'Ergenis passt nicht zum Schema ' + 'issues'
+
+ assert_tag :tag => 'issues', :children => {:count => 6}
+ assert_tag :tag => 'issue', :attributes => {:id => 1}
+ assert_tag :tag => 'issue', :attributes => {:id => 2}
+ assert_tag :tag => 'issue', :attributes => {:id => 3}
+ assert_tag :tag => 'issue', :attributes => {:id => 5}
+ assert_tag :tag => 'issue', :attributes => {:id => 7}
+ assert_tag :tag => 'issue', :attributes => {:id => 13}
+ end
+
# def test_query_by_string
# post :query, :project_id => 1, :query_string => 'project_id=1&set_filter=1&fields[]=tracker_id&operators[tracker_id]=%3D&values[tracker_id][]=1&fields[]=category_id&operators[category_id]=!*&values[category_id][]=1'
#

0 comments on commit cab8d5f

Please sign in to comment.