Skip to content

Commit

Permalink
Redirect root when get :edit with html
Browse files Browse the repository at this point in the history
  • Loading branch information
takuyan committed Jun 16, 2014
1 parent 88c53eb commit e289446
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/controllers/tasks_controller.rb
Expand Up @@ -29,6 +29,10 @@ def new
# GET /tasks/1/edit
def edit
@this_week = Week.current
respond_with @task do |f|
f.js { render }
f.html { redirect_to root_path }
end
end

# POST /tasks
Expand Down
9 changes: 9 additions & 0 deletions spec/controllers/tasks_controller_spec.rb
Expand Up @@ -10,6 +10,15 @@
let(:task) { create :task, user_id: user.id }
let(:task_params) { attributes_for :task, user_id: user.id }

context 'with {format: :html}' do
describe 'GET #edit' do
it 'redirect_to root_url' do
get :edit, id: task.id
expect(response).to redirect_to root_url
end
end
end

context 'with {format: :json}' do
describe 'GET #index' do
it 'json is works' do
Expand Down

0 comments on commit e289446

Please sign in to comment.