Open
Conversation
…hanges before, Oopsgit status
…g completion of a task
CheezItMan
reviewed
Apr 16, 2019
| expect(new_task.description).must_equal task_hash[:task][:description] | ||
| expect(new_task.due_date.to_time.to_i).must_equal task_hash[:task][:due_date].to_i | ||
| expect(new_task.completed).must_equal task_hash[:task][:completed] | ||
| expect(new_task.completion_date).must_equal task_hash[:task][:completion_date] |
There was a problem hiding this comment.
Since you don't have a completion_date field this should be expect(new_task.current_status).must_equal task_hash[:task][:current_status]
And you'll need to update the task_hash.
| let (:task) { | ||
| Task.create name: "sample task", description: "this is an example for a test", | ||
| completion_date: Time.now + 5.days | ||
| completion_date: Time.now # I need to make the completion respond to a toggle |
There was a problem hiding this comment.
This should also be current_status: true or set it to false.
|
|
||
| # create tasklist hash | ||
|
|
||
| TASKS = [ |
There was a problem hiding this comment.
You can delete this now that you have the model
| def edit | ||
| @task = Task.find_by(id: params[:id]) | ||
| if @task.nil? | ||
| redirect_to tasks_path :flash => {:error => "Task does not exist!"} |
| redirect_to task_path(task.id) | ||
| end | ||
| else | ||
| redirect_to tasks_path :flash => {:error => "The task was deleted!"} |
There was a problem hiding this comment.
nice flash message, but also the task might never have existed.
| end | ||
|
|
||
| def toggle | ||
| task = Task.find_by(id: params[:id]) |
There was a problem hiding this comment.
You should have an if statement to see if you can find the task... just saying...
Task ListWhat We're Looking For
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task List
Congratulations! You're submitting your assignment!
Comprehension Questions