test/base/test_site.rb in nanoc-3.7.4 vs test/base/test_site.rb in nanoc-3.7.5

- old
+ new

@@ -1,9 +1,8 @@ # encoding: utf-8 class Nanoc::SiteTest < Nanoc::TestCase - def test_initialize_with_dir_without_config_yaml assert_raises(Nanoc::Errors::GenericTrivial) do Nanoc::Site.new('.') end end @@ -19,16 +18,16 @@ site = Nanoc::Site.new('.') assert_equal 'public_html', site.config[:output_dir] end def test_initialize_with_config_hash - site = Nanoc::Site.new(:foo => 'bar') + site = Nanoc::Site.new(foo: 'bar') assert_equal 'bar', site.config[:foo] end def test_initialize_with_incomplete_data_source_config - site = Nanoc::Site.new(:data_sources => [{ :type => 'foo', :items_root => '/bar/' }]) + site = Nanoc::Site.new(data_sources: [{ type: 'foo', items_root: '/bar/' }]) assert_equal('foo', site.config[:data_sources][0][:type]) assert_equal('/bar/', site.config[:data_sources][0][:items_root]) assert_equal('/', site.config[:data_sources][0][:layouts_root]) assert_equal({}, site.config[:data_sources][0][:config]) end @@ -72,11 +71,11 @@ parent_config_file: foo/foo.yaml EOF end error = assert_raises(Nanoc::Errors::GenericTrivial) do - site = Nanoc::Site.new('.') + Nanoc::Site.new('.') end assert_equal( "Could not find parent configuration file 'foo/foo.yaml'", error.message ) @@ -96,11 +95,11 @@ EOF end end error = assert_raises(Nanoc::Errors::GenericTrivial) do - site = Nanoc::Site.new('.') + Nanoc::Site.new('.') end assert_equal( "Cycle detected. Could not use parent configuration file '../nanoc.yaml'", error.message ) @@ -211,64 +210,58 @@ site = Nanoc::Site.new('.') site.load end end end - end describe 'Nanoc::Site#initialize' do - include Nanoc::TestHelpers it 'should merge default config' do - site = Nanoc::Site.new(:foo => 'bar') + site = Nanoc::Site.new(foo: 'bar') site.config[:foo].must_equal 'bar' site.config[:output_dir].must_equal 'output' end it 'should not raise under normal circumstances' do Nanoc::Site.new({}) end it 'should not raise for non-existant output directory' do - Nanoc::Site.new(:output_dir => 'fklsdhailfdjalghlkasdflhagjskajdf') + Nanoc::Site.new(output_dir: 'fklsdhailfdjalghlkasdflhagjskajdf') end it 'should not raise for unknown data sources' do proc do - Nanoc::Site.new(:data_source => 'fklsdhailfdjalghlkasdflhagjskajdf') + Nanoc::Site.new(data_source: 'fklsdhailfdjalghlkasdflhagjskajdf') end end - end describe 'Nanoc::Site#compiler' do - include Nanoc::TestHelpers it 'should not raise under normal circumstances' do site = Nanoc::Site.new({}) site.compiler end - end describe 'Nanoc::Site#data_sources' do - include Nanoc::TestHelpers it 'should not raise for known data sources' do site = Nanoc::Site.new({}) site.data_sources end it 'should raise for unknown data sources' do proc do site = Nanoc::Site.new( - :data_sources => [ - { :type => 'fklsdhailfdjalghlkasdflhagjskajdf' } + data_sources: [ + { type: 'fklsdhailfdjalghlkasdflhagjskajdf' } ] ) site.data_sources end.must_raise Nanoc::Errors::UnknownDataSource end @@ -289,7 +282,6 @@ assert data_sources.first.config[:aaa] = 'one' assert data_sources.first.config[:bbb] = 'two' end end - end