Commit 87c39b6d authored by Martin Cabrera's avatar Martin Cabrera

Added specs for the preservation of the from/to parameter

parent 0413a7ad
...@@ -65,7 +65,27 @@ describe Projects::CompareController do ...@@ -65,7 +65,27 @@ describe Projects::CompareController do
expect(assigns(:commits)).to eq(nil) expect(assigns(:commits)).to eq(nil)
end end
it 'redirects back to index when params[:from] & params[:to] are empty' do it 'redirects back to index when params[:from] is empty and preserves params[:to]' do
post(:create,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
from: '',
to: 'master')
expect(response).to redirect_to(namespace_project_compare_index_path(project.namespace, project, to: 'master'))
end
it 'redirects back to index when params[:to] is empty and preserves params[:from]' do
post(:create,
namespace_id: project.namespace.to_param,
project_id: project.to_param,
from: 'master',
to: '')
expect(response).to redirect_to(namespace_project_compare_index_path(project.namespace, project, from: 'master'))
end
it 'redirects back to index when params[:from] and params[:to] are empty' do
post(:create, post(:create,
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project.to_param,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment