Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests that we can update user params and go back to the edit registra…
…tion page.
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
RSpec.describe Members::RegistrationsController, type: :controller do | ||
describe "#update" do | ||
let(:password) { Faker::Internet.password } | ||
let!(:member) { create(:member, password: password) } | ||
|
||
before do | ||
set_devise_mapping(:member) | ||
sign_in member | ||
end | ||
|
||
def go!(params) | ||
put :update, params | ||
end | ||
|
||
let(:params) do | ||
{ | ||
member: { | ||
email: "new-email@example.com", | ||
name: "Test person", | ||
enable_vending_machine: "1", | ||
current_password: password, | ||
} | ||
} | ||
end | ||
|
||
it "updates all allowed params" do | ||
go! params | ||
member.reload | ||
|
||
expect(member.email).to eq("new-email@example.com") | ||
expect(member.name).to eq("Test person") | ||
expect(member.enable_vending_machine).to eq(true) | ||
expect(response).to redirect_to(edit_member_registration_path) | ||
end | ||
end | ||
end |