Commit f4e2847e by tady

Merge pull request #73 from tadyjp/wip/140401_fix_devise

[WIP] deviseのroutingエラー修正
parents 5480173c 36905501
......@@ -49,6 +49,7 @@ end
gem 'mysql2'
gem 'devise'
gem 'omniauth-google-oauth2'
# Markdown
......
......@@ -7,7 +7,7 @@ class UsersController < ApplicationController
def update
respond_to do |format|
if @user.update(user_params)
format.html { redirect_to edit_user_path(@user), flash: { notice: 'Post was successfully updated.' } }
format.html { redirect_to edit_user_path, flash: { notice: 'Post was successfully updated.' } }
format.json { head :no_content }
else
format.html { render action: 'edit' }
......
......@@ -40,6 +40,6 @@ nav.navbar.navbar-default.navbar-fixed-top role="navigation"
a href=edit_user_path(current_user) マイページ
li.divider
li
a href=destroy_user_session_path data-method="delete" rel="nofollow" SignOut
a href=sign_out_path data-method="delete" rel="nofollow" SignOut
......@@ -21,8 +21,16 @@ Rendezvous::Application.routes.draw do
post 'tags/:name/move_to/:move_to_name' => 'tags#move_to', as: 'move_to_tag'
resources :tags, :param => :name
resources :users, :only => [:edit, :update]
devise_for :users , controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
resource :user, :only => [:edit, :update]
# devise_for :users , controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
# devise_for :users , only: [:sign_in, :sign_out, :session]
devise_for :users, controllers: { omniauth_callbacks: "users/omniauth_callbacks" }, skip: [:sessions]
devise_scope :user do
# get 'sign_in', to: 'users/sessions#new', as: :new_user_session
delete 'sign_out', to: 'devise/sessions#destroy', as: :sign_out
end
# get 'users/edit' => 'users#edit', as: 'edit_user'
# post 'users/update' => 'users#update', as: 'update_user'
......
......@@ -2,20 +2,23 @@ require 'spec_helper'
describe UsersController do
before do
end
describe "GET 'edit'" do
pending
# it "returns http success" do
# get :edit
# response.should be_success
# end
login_user
it "returns http success" do
get :edit
response.should be_success
end
end
describe "GET 'update'" do
pending
# it "returns http success" do
# put :update
# response.should be_success
# end
login_user
it "returns http success" do
patch :update, user: { nickname: 'bob' }
response.should redirect_to('/user/edit')
end
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