Add test for updating user profile
This commit is contained in:
parent
8302f1b396
commit
65fa3ff018
|
@ -43,6 +43,28 @@ describe UserController, type: :controller do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#update_profile" do
|
||||||
|
subject { patch :update_profile, params: { profile: profile_params } }
|
||||||
|
let(:profile_params) do
|
||||||
|
{
|
||||||
|
display_name: 'sneaky cune'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
context "user signed in" do
|
||||||
|
before(:each) { sign_in user }
|
||||||
|
|
||||||
|
it "updates the user's profile" do
|
||||||
|
expect { subject }.to change{ user.profile.reload.display_name }.to('sneaky cune')
|
||||||
|
end
|
||||||
|
|
||||||
|
it "redirects to the edit_user_profile page" do
|
||||||
|
subject
|
||||||
|
expect(response).to redirect_to(:edit_user_profile)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#update" do
|
describe "#update" do
|
||||||
subject { patch :update, params: { user: header_params } }
|
subject { patch :update, params: { user: header_params } }
|
||||||
let(:header_params) do
|
let(:header_params) do
|
||||||
|
|
Loading…
Reference in New Issue