In a test file I had the functioning line:
get edit_password_reset_path(user.reset_token, email: "")
and in the controller I had:
def edit
end
This worked but now I had to change the controller to:
def edit
if @org
render action: "editorg"
elsif @mem
render action: "editmem"
end
end
This allows for a different form to show up for a passwords reset, depending on the type of user. So there is an editorg.html.erb and an editmem.html.erb. This again works.
What not works is the old test line. But how should I change it since the route path that the test line refers to has not changed? As it is, it still looks for edit.html.erb and I get the error message: ActionView::MissingTemplate: Missing template password_resets/edit ...
In case more information on the test file is needed:
def setup ActionMailer::Base.deliveries.clear @member = members(:michael) end
test "password resets" do get new_password_reset_path assert_template 'password_resets/new' # Invalid email post password_resets_path, password_reset: { email: "" } assert_not flash.empty? assert_template 'password_resets/new' # Valid email post password_resets_path, password_reset: { email: @member.email } assert_not_equal @member.reset_digest, @member.reload.reset_digest assert_equal 1, ActionMailer::Base.deliveries.size assert_not flash.empty? assert_redirected_to root_url # Password reset form member = assigns(:member) # Wrong email get edit_password_reset_path(member.reset_token, email: "") ...here I get the error message.
Aucun commentaire:
Enregistrer un commentaire