Sha256: f26ca233348590077953a6abd4ebf3ce62b7bab106ddee853d59f7fe8fc21301

Contents?: true

Size: 1.28 KB

Versions: 10

Compression:

Stored size: 1.28 KB

Contents

# -*- encoding : utf-8 -*-
Testing Dao::Conducer do
  testing 'that dao has a root' do
    assert{ Dao.respond_to?(:root) }
    assert{ Dao.root }
  end

  testing 'that dao can build a mock controller' do
    controller = assert{ Dao.mock_controller }
    assert{ controller.url_for '/' }
  end

  testing 'that dao can mark the current_controller' do
    assert{ Dao.current_controller = Dao.mock_controller }
  end

  testing 'that dao can pre-process parameters' do
    params = Map.new( 
      'dao' => {
        'foos' => {
          'k' => 'v',
          'array.0' => '0',
          'array.1' => '1'
        },

        'bars' => {
          'a' => 'b',
          'hash.k' => 'v',
          '~42' => 'foobar'
        }
      }
    )

    assert{ Dao.normalize_parameters(params) }

    assert{ params[:foos].is_a?(Hash) }
    assert{ params[:foos][:k] == 'v' }
    assert{ params[:foos][:array] == %w( 0 1 ) }

    assert{ params[:bars].is_a?(Hash) }
    assert{ params[:bars][:a] == 'b' }
    assert{ params[:bars][:hash] == {'k' => 'v'} }
    assert{ params[:bars]['42'] == 'foobar' }
  end
end


BEGIN {
  testdir = File.dirname(File.expand_path(__FILE__))
  rootdir = File.dirname(testdir)
  libdir = File.join(rootdir, 'lib')
  require File.join(libdir, 'dao')
  require File.join(testdir, 'testing')
}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dao-5.5.0 test/support_test.rb
dao-5.4.0 test/support_test.rb
dao-5.3.3 test/support_test.rb
dao-5.3.2 test/support_test.rb
dao-5.3.0 test/support_test.rb
dao-5.2.1 test/support_test.rb
dao-5.1.2 test/support_test.rb
dao-5.1.1 test/support_test.rb
dao-5.0.0 test/support_test.rb
dao-4.6.4 test/support_test.rb