Ruby Build a Todo List Application with Rails 4 Build a Todo List Application with Rails 4 Deleting Todo Lists

steven alston
steven alston
16,292 Points

let(:invalid_attributes) { {"title" =>"", "description" => "" } }

This cleared up several of the pending conflicts in the bin/rake spec test

let(:invalid_attributes) { {"title" =>"", "description" => "" } } 

However, I still have conflicts/items pending for the PUT update block for :new_attributes and assertions, any help on what to add here would be appreciated. Thanks!

todo_lists_controller_spec.rb
describe "PUT update" do
    describe "with valid params" do
      let(:new_attributes) {
        {}
      }

      it "updates the requested todo_list" do
        todo_list = TodoList.create! valid_attributes
        put :update, {:id => todo_list.to_param, :todo_list => new_attributes}, valid_session
        todo_list.reload
        skip("Add assertions for updated state")
      end

2 Answers

steven alston
steven alston
16,292 Points

This cleared all the examples that were pending, except for the ones the were still pending in the video.

todo_lists_controller_spec.rb

 let(:valid_attributes) {
    {
      "title" => "My String",
      "description" => "My Description"
    }
  }

  let(:invalid_attributes) {
    {
      "title" => "",
      "description" => ""
    }
  }

#more describe blocks

describe "PUT update" do
    describe "with valid params" do
      let(:new_attributes) {
          {title: 'updated_title', description: 'updated_description'}
        }

      it "updates the requested todo_list" do
        todo_list = TodoList.create! valid_attributes
        put :update, {:id => todo_list.to_param, :todo_list => new_attributes}, valid_session
        todo_list.reload
        expect(controller.notice).to eq("Todo list was successfully updated.")
      end
Maciej Czuchnowski
Maciej Czuchnowski
36,437 Points

As far as 'pending' is concerned, the whole 'skip' line should not be there. Remove it and see if that helps. When in doubt, look at Jason's code ( http://treehouse-code-samples.s3.amazonaws.com/odot/odot-8.zip ) unless you're using different version or RSpec.

steven alston
steven alston
16,292 Points

Maciej Czuchnowski,

Using rspec version 3.1.7 I have read other comments from you related to this version. However, I don't want to go through the trouble of reinstalling everything. Do know what arguments could be added to the :new_attributes? Also, what assertions would I need to write? I previously added the <bold> let( :new_attributes) {{title: "updated_title" and description: "updated_description" }}</bold> which cleared the error for that, but it still gave me the error that it needed assertions. Not sure what to add here, or if the :new_attributes was correct? Thanks for your help!