spec/generator_spec.rb in ore-0.7.1 vs spec/generator_spec.rb in ore-0.7.2

- old
+ new

@@ -155,24 +155,96 @@ it "should add 'Gemfile.lock' to the .gitignore file" do gitignore.should include('Gemfile.lock') end end + context "rdoc" do + let(:name) { 'rdoc-project' } + + before(:all) do + generate!(name, :rdoc => true) + end + + it "should disable the yard template" do + @generator.disabled_templates.should include(:yard) + end + + it "should set @markup to :rdoc" do + @generator.instance_variable_get('@markup').should == :rdoc + end + + it "should add 'html/' to the .gitignore file" do + gitignore.should include('html/') + end + + it "should add a '.document' file" do + @path.join('.document').should be_file + end + + context ".document" do + it "should include 'lib/**/*.rb'" do + document.should include('lib/**/*.rb') + end + + it "should include 'README.rdoc'" do + document.should include('README.rdoc') + end + + it "should include 'ChangeLog.rdoc'" do + document.should include('ChangeLog.rdoc') + end + + it "should include 'LICENSE.txt'" do + document.should include('LICENSE.txt') + end + end + end + context "yard" do let(:name) { 'yard-project' } before(:all) do generate!(name, :yard => true) end + it "should disable the rdoc template" do + @generator.disabled_templates.should include(:rdoc) + end + it "should add a .yardopts file" do @path.join('.yardopts').should be_file end it "should set 'has_yard' to 'true' in the gemspec.yml file" do @gemspec['has_yard'].should == true end + + it "should add a '.document' file" do + @path.join('.document').should be_file + end + + context ".document" do + it "should not include 'lib/**/*.rb'" do + document.should_not include('lib/**/*.rb') + end + + it "should include a '-' separator for non-code files" do + document.should include('-') + end + + it "should not include 'README.*'" do + document.grep(/^README\./).should be_empty + end + + it "should include 'ChangeLog.*'" do + document.should include('ChangeLog.*') + end + + it "should include 'LICENSE.txt'" do + document.should include('LICENSE.txt') + end + end end context "yard with markdown" do let(:name) { 'yard_markdown-project' } @@ -223,17 +295,45 @@ it "should still add 'yard' as a development dependency" do @gemspec['development_dependencies'].should have_key('yard') end end + context "test_unit" do + let(:name) { 'test_unit_project' } + + before(:all) do + generate!(name, :test_unit => true) + end + + it "should disable the rspec template" do + @generator.disabled_templates.should include(:rspec) + end + + it "should create the test/ directory" do + @path.join('test').should be_directory + end + + it "should create the test/helper.rb file" do + @path.join('test','helper.rb').should be_file + end + + it "should add a single test_*.rb file" do + @path.join('test','test_test_unit_project.rb').should be_file + end + end + context "rspec" do let(:name) { 'rspec_project' } before(:all) do generate!(name, :rspec => true) end + it "should disable the test_unit template" do + @generator.disabled_templates.should include(:test_unit) + end + it "should not create the test/ directory" do @path.join('test').should_not be_directory end it "should create the spec/ directory" do @@ -274,10 +374,14 @@ before(:all) do generate!(name, :jeweler_tasks => true) end + it "should disable the ore_tasks template" do + @generator.disabled_templates.should include(:ore_tasks) + end + it "should add 'jeweler' as a development dependency" do @gemspec['development_dependencies'].should have_key('jeweler') end end @@ -296,9 +400,13 @@ context "ore tasks" do let(:name) { 'ore_project' } before(:all) do generate!(name, :ore_tasks => true) + end + + it "should disable the jeweler_tasks template" do + @generator.disabled_templates.should include(:jeweler_tasks) end it "should omit 'ore-core' as a development dependency" do @gemspec['development_dependencies'].should_not have_key('ore-core') end