Commit aeb12b9c authored by Alexandre Friquet's avatar Alexandre Friquet

Conditionnal redirection for admin after member edition: refs #69.

parent da45ee41
......@@ -153,7 +153,8 @@ class MembersController < ApplicationController
render :action => "edit"
else
if admin?
redirect_to members_url(:mg_id => params[:selected_mg])
redirect = (params[:selected_mg].present? ? members_url(mg_id: params[:selected_mg]) : @member)
redirect_to redirect
else
redirect_to @member
end
......
......@@ -124,14 +124,15 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
within "section#content" do
expect(page).to have_content "Compte mis à jour avec succès."
click_link "Membres sans groupe"
pending "works in UI, AJAX :("
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
end
visit members_path
click_link "Membres sans groupe"
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
expect(current_path).to eq(member_path(@member))
......@@ -152,14 +153,15 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
within "section#content" do
expect(page).to have_content "Compte mis à jour avec succès."
click_link "Membres sans groupe"
pending "works in UI, AJAX :("
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
end
visit members_path
click_link "Membres sans groupe"
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
expect(current_path).to eq(member_path(@member))
......@@ -184,14 +186,15 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
within "section#content" do
expect(page).to have_content "Compte mis à jour avec succès."
click_link "Membres sans groupe"
pending "works in UI, AJAX :("
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
end
visit members_path
click_link "Membres sans groupe"
within "ul#ungrouped" do
click_link "#{@member.name} - #{@member.login}"
end
expect(current_path).to eq(member_path(@member))
......@@ -218,7 +221,7 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
expect(page).to have_content "Compte mis à jour avec succès."
visit member_path @member
......@@ -244,7 +247,7 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
expect(page).to have_content "Compte mis à jour avec succès."
visit member_path @member
......@@ -273,7 +276,7 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
expect(page).to have_content "Compte mis à jour avec succès."
visit member_path @member
......@@ -335,13 +338,15 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
within "section#content" do
expect(page).to have_content "Compte mis à jour avec succès."
click_link mg.title
pending "works in UI, AJAX :("
expect(page).to have_selector("li", text: @member.name)
end
visit members_path
click_link mg.title
expect(page).to have_selector("li", text: @member.name)
end
scenario "I can set its registry date" do
......@@ -352,12 +357,9 @@ feature "Manage members" do
click_update_button
end
expect(current_path).to eq(members_path)
expect(current_path).to eq(member_path(@member))
within "section#content" do
expect(page).to have_content "Compte mis à jour avec succès."
end
visit member_path @member.reload
within "section#content" do
expect(page).to have_content registry_date
end
end
......
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