Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let(:new_user_attributes) do
- {
- name: "BlocHead",
- email: "blochead@bloc.io",
- password: "blochead",
- password_confirmation: "blochead"
- }
- end
- it "sets user name properly" do
- post :create, params: { user: new_user_attributes }
- expect(assigns(:user).name).to eq new_user_attributes[:name]
- end
- def create
- @user = User.new
- @user.name = params[:user][:name]
- @user.email = params[:user][:email]
- @user.password = params[:user][:password]
- @user.password_confirmation = params[:user][:password_confirmation]
- if @user.save
- flash[:notice] = "Welcome to Bloccit #{@user.name}!"
- redirect_to root_path
- else
- flash.now[:alert] = "There was an error creating your account. Please try again."
- render :new
- end
- end
Add Comment
Please, Sign In to add comment