Sha256: 1c4e251a248335712bccdc9acfd4539724cc258a7f03585b5f883381ef338877

Contents?: true

Size: 1.47 KB

Versions: 14

Compression:

Stored size: 1.47 KB

Contents

Shindo.tests('test_helper', 'meta') do

  tests('#formats_kernel') do

    tests('returns true') do

      test('when format of value matches') do
        formats_kernel({:a => :b}, {:a => Symbol})
      end

      test('when format of nested array elements matches') do
        formats_kernel({:a => [:b, :c]}, {:a => [Symbol]})
      end

      test('when format of nested hash matches') do
        formats_kernel({:a => {:b => :c}}, {:a => {:b => Symbol}})
      end

      test('when format of an array') do
        formats_kernel([{:a => :b}], [{:a => Symbol}])
      end

      test('non strict extra data') do
        formats_kernel({:a => :b, :b => :c}, {:a => Symbol}, true, false)
      end

    end

    tests('returns false') do

      test('when format of value does not match') do
        !formats_kernel({:a => :b}, {:a => String})
      end

      test('when not all keys are checked') do
        !formats_kernel({:a => :b}, {})
      end

      test('when some keys do not appear') do
        !formats_kernel({}, {:a => String})
      end

      test('when an array is expected but another data type is found') do
        !formats_kernel({:a => 'not an array'}, {:a => []})
      end

      test('when a hash is expected but another data type is found') do
        !formats_kernel({:a => 'not a hash'}, {:a => {}}, true, false)
      end


      test('non strict extra data') do
        !formats_kernel({:a => :b, :b => :c}, {:z => Symbol}, true, false)
      end

    end

  end

end

Version data entries

14 entries across 14 versions & 6 rubygems

Version Path
fog-nirvanix-1.8.2 tests/helpers/formats_helper_tests.rb
fog-nirvanix-1.8.1 tests/helpers/formats_helper_tests.rb
fog-parser-fix-1.6.1 tests/helpers/formats_helper_tests.rb
fog-test-again-1.6.0 tests/helpers/formats_helper_tests.rb
fog-parser-fix-1.6.0 tests/helpers/formats_helper_tests.rb
fog-1.9.0 tests/helpers/formats_helper_tests.rb
fog-maestrodev-1.8.0.20130114204828 tests/helpers/formats_helper_tests.rb
fog-maestrodev-1.8.0.20130111070250 tests/helpers/formats_helper_tests.rb
fog-maestrodev-1.8.0.20130109172219 tests/helpers/formats_helper_tests.rb
fog-sgonyea-1.8.1 tests/helpers/formats_helper_tests.rb
fog-1.8.0 tests/helpers/formats_helper_tests.rb
fog-maestrodev-1.7.0.20121114190951 tests/helpers/formats_helper_tests.rb
fog-1.7.0 tests/helpers/formats_helper_tests.rb
fog-1.6.0 tests/helpers/formats_helper_tests.rb