Sha256: 7d5e1c394a426bb2a0946e122f6380c055e51d5c6efc5ba382fd1ce2bf05be23
Contents?: true
Size: 1.24 KB
Versions: 48
Compression:
Stored size: 1.24 KB
Contents
require 'spec_helper' describe RailsWizard::Template do subject{ RailsWizard::Template } let(:recipe){ RailsWizard::Recipe.generate('name','# test') } describe '#initialize' do it 'should work with classes' do subject.new([recipe]).recipes.should == [recipe] end end describe '#recipes_with_dependencies' do def r(*deps) mock(:Class, :requires => deps, :superclass => RailsWizard::Recipe) end subject do @template = RailsWizard::Template.new([]) @template.stub!(:recipes).and_return(@recipes) @template.stub!(:recipe_classes).and_return(@recipes) @template end it 'should return the same number recipes if none have dependencies' do @recipes = [r, r] subject.recipes_with_dependencies.size.should == 2 end it 'should handle simple dependencies' do @recipes = [r(r, r), r(r)] subject.recipes_with_dependencies.size.should == 5 end it 'should handle multi-level dependencies' do @recipes = [r(r(r))] subject.recipes_with_dependencies.size.should == 3 end it 'should uniqify' do a = r b = r(a) c = r(r, a, b) @recipes = [a,b,c] subject.recipes_with_dependencies.size.should == 4 end end end
Version data entries
48 entries across 48 versions & 4 rubygems