Created
September 25, 2012 21:52
-
-
Save r38y/3784696 to your computer and use it in GitHub Desktop.
This file contains 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
# passes (from different app) | |
it "should associate with a location with location_ids" do | |
location = create(:location) | |
vendor = create(:vendor, location_ids: [location.id]) | |
vendor.reload | |
vendor.locations.should include(location) | |
end | |
# fails | |
it "should associate with a category with category_ids" do | |
category = create(:category) | |
drawing = create(:drawing, category_ids: [category.id]) | |
drawing.reload | |
drawing.categories.should include(category) | |
end | |
# passes | |
it "should associate with a category with category_ids" do | |
category = create(:category) | |
drawing = create(:drawing) | |
drawing.category_ids = [category.id] | |
drawing.save | |
drawing.reload | |
drawing.categories.should include(category) | |
end |
Doesn't help. The reason I went down this trail is selecting categories with a checkbox wasn't working when creating the drawing so I created these tests to help me figure it out. Watching the logs, nothing gets inserted into the db when creating but it does on update. Thanks though!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about
drawing.categories(true).should include(category)
?