Last active
August 29, 2015 13:56
-
-
Save themoxman/9025329 to your computer and use it in GitHub Desktop.
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
| # SO MUCH SETUP!!!!! | |
| require 'spec_helper' | |
| describe NoteHandler do | |
| describe "#add_tags" do | |
| it "adds new and existing Tags to the Note", focus: true do | |
| collection = Collection.create(name: "Programming") | |
| note = collection.notes.create(title: "ActiveRecord", content: "Some awesome ActiveRecord content.") | |
| rails = collection.tags.create(name: "Rails") | |
| database = collection.tags.create(name: "Database") | |
| new_tags = " RSpec, Ruby " | |
| existing_tags = "#{rails.name}, #{database.name}, " | |
| note.add_tags(existing_tags, new_tags) | |
| expect(note.tags).to have(4).items | |
| expect(note.tags).to match_array(Tag.all) | |
| end | |
| end | |
| end | |
| # describe "#add_tags" do | |
| # let(:note) { create(:note) } | |
| # it "adds new and existing Tags to the Note", focus: true do | |
| # # it handles extra whitespace in new_tags, params[:new_tags] | |
| # new_tags = " RSpec, Ruby " | |
| # # create existing tags | |
| # rails = create(:tag, name: "Rails", collection: note.collection) | |
| # database = create(:tag, name: "Database", collection: note.collection) | |
| # # existing tags params string, params[:tag_list] | |
| # # note the extra comma and space at the end. | |
| # # this is the way my JS function passes existing | |
| # # tags to the controller | |
| # existing_tags = "#{rails.name}, #{database.name}, " | |
| # note.add_tags(existing_tags, new_tags) | |
| # expect(note.tags).to have(4).items | |
| # end | |
| # end | |
| # end | |
| # context "with existing tags params" do | |
| # it "adds them to the note" | |
| # end | |
| # end | |
| # describe "#add_new_tags" do | |
| # it "adds new tags to the note" do | |
| # add_new_tags(new_tags) | |
| # expect() | |
| # end | |
| # end | |
| # describe "#tag_names", focus: true do | |
| # it "returns an array of tag names" do | |
| # # note the extra whitespace in the string | |
| # new_tags = "RSpec, Ruby, Rails " | |
| # end | |
| # end | |
| # describe Classroom do | |
| # subject(:classroom) { Classroom.new } | |
| # context "when the children are rowdy" do | |
| # before { classroom.throw_pizza_party } | |
| # it { should be_a_mess } | |
| # end | |
| # end | |
| # Parameters: {"utf8"=>"✓", "authenticity_token"=>"H6tbVG+9aVXV3NYMztwHQEudsKKZ2fKnJPXI98ow1AE=", "note"=>{"title"=>"dave", "content"=>"dave"}, "new_tags"=>"People, Entrepreneurs ", "tag_list"=>"Ruby, Rails, ActiveRecord, ", "commit"=>"Add Note", "collection_id"=>"9"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment