From 22ae12185dbef9ba21629ab6067fc425a2e00a33 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Tue, 6 Aug 2013 20:39:17 +0000 Subject: [PATCH] Improve Recipe spec: * Fix coding standards; * Add spec for default assigned filepath; * Add spec for #filepath accessor; * Test object identity in #code spec. --- spec/producer/core/recipe_spec.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/spec/producer/core/recipe_spec.rb b/spec/producer/core/recipe_spec.rb index c9ff15a..53f6daf 100644 --- a/spec/producer/core/recipe_spec.rb +++ b/spec/producer/core/recipe_spec.rb @@ -8,7 +8,7 @@ module Producer::Core subject(:recipe) { Recipe.new(code) } describe '.from_file' do - let (:filepath) { fixture_path_for 'recipes/empty.rb' } + let(:filepath) { fixture_path_for 'recipes/empty.rb' } subject(:recipe) { Recipe.from_file(filepath) } it 'builds a recipe whose code is read from given file path' do @@ -21,14 +21,23 @@ module Producer::Core end describe '#initialize' do - it 'builds a recipe' do - expect(recipe).to be_a Recipe + it 'assigns nil as a default filepath' do + expect(recipe.filepath).to be nil end end describe '#code' do it 'returns the assigned code' do - expect(recipe.code).to eq code + expect(recipe.code).to be code + end + end + + describe '#filepath' do + let(:filepath) { 'some_file_path' } + let(:recipe) { Recipe.new(code, filepath) } + + it 'returns the assigned file path' do + expect(recipe.filepath).to eq filepath end end