require 'spec_helper'
describe Recipe do
it 'Instance an object of type Recipe' do
recipe = Recipe.new(title: 'Salad',
description: 'You have never eaten a recipe like this',
ingredients: 'Lettuce and Tomatoes',
cook_time: 10,
featured: true)
expect(recipe.class).to eq Recipe
expect(recipe.title).to eq 'Salad'
expect(recipe.description).to eq 'You have never eaten a recipe like this'
expect(recipe.ingredients).to eq 'Lettuce and Tomatoes'
expect(recipe.cook_time).to eq 10
expect(recipe.featured).to eq true
end
it 'Converts a json to an object of type Recipe' do
recipe = Recipe.from_json('data/pudding.json')
expect(recipe.class).to eq Recipe
expect(recipe.title).to eq 'Pudding'
expect(recipe.description).to eq 'The best pudding of your life!'
expect(recipe.ingredients).to eq 'Canned milk, eggs and milk'
expect(recipe.cook_time).to eq 10
expect(recipe.featured).to eq true
end
it 'Converts another json to an object of type recipe' do
recipe = Recipe.from_json('data/salad.json')
expect(recipe.class).to eq Recipe
expect(recipe.title).to eq 'Salad'
expect(recipe.description).to eq 'You have never eaten a recipe like this'
expect(recipe.ingredients).to eq 'Lettuce and Tomatoes'
expect(recipe.cook_time).to eq 20
expect(recipe.featured).to eq false
end
end
describe Recipe do
it 'Instance an object of type Recipe' do
recipe = Recipe.new(title: 'Salad',
description: 'You have never eaten a recipe like this',
ingredients: 'Lettuce and Tomatoes',
cook_time: 10,
featured: true)
expect(recipe.class).to eq Recipe
expect(recipe.title).to eq 'Salad'
expect(recipe.description).to eq 'You have never eaten a recipe like this'
expect(recipe.ingredients).to eq 'Lettuce and Tomatoes'
expect(recipe.cook_time).to eq 10
expect(recipe.featured).to eq true
end
it 'Converts a json to an object of type Recipe' do
recipe = Recipe.from_json('data/pudding.json')
expect(recipe.class).to eq Recipe
expect(recipe.title).to eq 'Pudding'
expect(recipe.description).to eq 'The best pudding of your life!'
expect(recipe.ingredients).to eq 'Canned milk, eggs and milk'
expect(recipe.cook_time).to eq 10
expect(recipe.featured).to eq true
end
it 'Converts another json to an object of type recipe' do
recipe = Recipe.from_json('data/salad.json')
expect(recipe.class).to eq Recipe
expect(recipe.title).to eq 'Salad'
expect(recipe.description).to eq 'You have never eaten a recipe like this'
expect(recipe.ingredients).to eq 'Lettuce and Tomatoes'
expect(recipe.cook_time).to eq 20
expect(recipe.featured).to eq false
end
end