test/base/test_site.rb in nanoc-4.0.2 vs test/base/test_site.rb in nanoc-4.1.0a1

- old
+ new

@@ -93,34 +93,10 @@ assert_raises(Nanoc::Int::ConfigLoader::CyclicalConfigFileError) do Nanoc::Int::SiteLoader.new.new_from_cwd end end - def test_load_rules_with_existing_rules_file - # Mock DSL - dsl = mock - dsl.stubs(:rules_filename) - dsl.stubs(:rules_filename=) - dsl.expects(:compile).with('*') - - # Create site - site = Nanoc::Int::SiteLoader.new.new_empty - site.compiler.rules_collection.stubs(:dsl).returns(dsl) - - # Create rules file - File.open('Rules', 'w') do |io| - io.write <<-EOF -compile '*' do - # ... do nothing ... -end -EOF - end - - # Load rules - site.compiler.rules_collection.load - end - def test_identifier_classes Nanoc::CLI.run %w( create_site bar) FileUtils.cd('bar') do FileUtils.mkdir_p('content') FileUtils.mkdir_p('layouts') @@ -138,74 +114,10 @@ assert_equal Nanoc::Identifier, layout.identifier.class end end end - def test_setup_child_parent_links - Nanoc::CLI.run %w( create_site bar) - FileUtils.cd('bar') do - FileUtils.mkdir_p('content/parent') - FileUtils.mkdir_p('content/parent/bar') - - data = File.read('nanoc.yaml').sub('identifier_type: full', 'identifier_type: legacy') - File.open('nanoc.yaml', 'w') { |io| io << data } - - File.open('content/parent.md', 'w') { |io| io << 'asdf' } - File.open('content/parent/foo.md', 'w') { |io| io << 'asdf' } - File.open('content/parent/bar.md', 'w') { |io| io << 'asdf' } - File.open('content/parent/bar/qux.md', 'w') { |io| io << 'asdf' } - - site = Nanoc::Int::SiteLoader.new.new_from_cwd - - root = site.items.find { |i| i.identifier == '/' } - style = site.items.find { |i| i.identifier == '/stylesheet/' } - parent = site.items.find { |i| i.identifier == '/parent/' } - foo = site.items.find { |i| i.identifier == '/parent/foo/' } - bar = site.items.find { |i| i.identifier == '/parent/bar/' } - qux = site.items.find { |i| i.identifier == '/parent/bar/qux/' } - - assert_equal Set.new([parent, style]), Set.new(root.children) - assert_equal Set.new([foo, bar]), Set.new(parent.children) - assert_equal Set.new([qux]), Set.new(bar.children) - - assert_equal nil, root.parent - assert_equal root, parent.parent - assert_equal parent, foo.parent - assert_equal parent, bar.parent - assert_equal bar, qux.parent - end - end - - def test_setup_child_parent_links_for_full_style_identifiers - Nanoc::CLI.run %w( create_site bar) - FileUtils.cd('bar') do - FileUtils.mkdir_p('content/parent') - FileUtils.mkdir_p('content/parent/bar') - - File.open('content/parent.md', 'w') { |io| io << 'asdf' } - File.open('content/parent/foo.md', 'w') { |io| io << 'asdf' } - File.open('content/parent/bar/qux.md', 'w') { |io| io << 'asdf' } - - site = Nanoc::Int::SiteLoader.new.new_from_cwd - - root = site.items.find { |i| i.identifier == '/index.html' } - parent = site.items.find { |i| i.identifier == '/parent.md' } - foo = site.items.find { |i| i.identifier == '/parent/foo.md' } - qux = site.items.find { |i| i.identifier == '/parent/bar/qux.md' } - - assert_equal Set.new([]), Set.new(root.children) - assert_equal Set.new([]), Set.new(parent.children) - assert_equal Set.new([]), Set.new(foo.children) - assert_equal Set.new([]), Set.new(qux.children) - - assert_equal nil, root.parent - assert_equal nil, parent.parent - assert_equal nil, foo.parent - assert_equal nil, qux.parent - end - end - def test_multiple_items_with_same_identifier with_site do File.open('content/sam.html', 'w') { |io| io.write('I am Sam!') } FileUtils.mkdir_p('content/sam') File.open('content/sam/index.html', 'w') { |io| io.write('I am Sam, too!') } @@ -224,16 +136,7 @@ assert_raises(Nanoc::Int::Errors::DuplicateIdentifier) do Nanoc::Int::SiteLoader.new.new_from_cwd end end - end -end - -describe 'Nanoc::Int::Site#compiler' do - include Nanoc::TestHelpers - - it 'should not raise under normal circumstances' do - site = Nanoc::Int::SiteLoader.new.new_empty - site.compiler end end