Skip to content

Commit

Permalink
issue 112 - bug discovered whilst working on #112, need to check for …
Browse files Browse the repository at this point in the history
…compatible units before adding/subtracting using unit1.compatible?(unit2)
  • Loading branch information
johnhutch committed Jun 7, 2017
1 parent 3e79ed4 commit e7d03b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spec/models/meal_plan_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
2 cloves garlic, finely chopped
4 cm piece of fresh ginger, peeled and finely chopped
6 1/2 lbs boneless pork shoulder, rind removed|) }
let(:recipe2) { FactoryGirl.create(:recipe, user: user1, ingredients_block: %Q|5 tbsp soy sauce
4 grams mild or hot chili powder
6 1/2 lbs boneless pork shoulder, rind removed|) }
let(:mealplan1) { FactoryGirl.create(:meal_plan, user: user1) }

it "doesn't crash when subtracting a recipe with a weird unit" do
Expand All @@ -17,4 +20,10 @@
expect(mealplan1).to be_valid
end

it "doesn't crash when trying to add incompatible units" do
mealplan1.recipes << recipe1
mealplan1.recipes << recipe2
expect(mealplan1).to be_valid
end

end

0 comments on commit e7d03b6

Please sign in to comment.