Merge pull request #1616 from opf/fix/only_open_wp_on_inital_wp_index

pull/1625/head
Hagen Schink 10 years ago
commit 13e84b89ce
  1. 2
      app/controllers/api/experimental/concerns/query_loading.rb
  2. 10
      spec/controllers/api/experimental/work_packages_controller_spec.rb

@ -35,7 +35,7 @@ module Api::Experimental::Concerns::QueryLoading
@query = Query.find(params[:query_id])
@query.project = @project if @query.project.nil?
else
@query = Query.new({name: "_", :project => @project})
@query = Query.new({ name: "_", :project => @project }, :initialize_with_default_filter => true)
end
prepare_query
@query

@ -86,6 +86,16 @@ describe Api::Experimental::WorkPackagesController do
get 'index', format: 'xml'
expect(response).to render_template('api/experimental/work_packages/index', formats: %w(api))
end
it 'assigns a query which has the default filter arguments set' do
expected_query = Query.new
expect(Query).to receive(:new).with(anything, initialize_with_default_filter: true)
.and_return(expected_query)
get 'index', format: 'xml'
expect(assigns(:query)).to eql expected_query
end
end
context 'with work packages' do

Loading…
Cancel
Save