diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb index 94528b9..58aaa5b 100644 --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -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 diff --git a/spec/controllers/tasks_controller_spec.rb b/spec/controllers/tasks_controller_spec.rb index becc734..b781ca3 100644 --- a/spec/controllers/tasks_controller_spec.rb +++ b/spec/controllers/tasks_controller_spec.rb @@ -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