Sha256: eebaf725530d2f5a3ae62312ccf91e0afda7674801b6271892acf049646cdbe2

Contents?: true

Size: 924 Bytes

Versions: 2

Compression:

Stored size: 924 Bytes

Contents

require 'helper'

class TestYamlDriver < Test::Unit::TestCase
  context 'yaml driver' do
    setup do
      @base = File.expand_path('../fixtures', __FILE__)
    end

    should 'throw exception if path option is not parsed in' do
      assert_raise FatalException do
        Monad::Drivers::YamlDriver.new({})
      end
    end

    should 'throw exception if path option is nil' do
      assert_raise Monad::FatalException do
        Monad::Drivers::YamlDriver.new('path' => nil)
      end
    end

    should 'throw exception if file does not exist' do
      assert_raise FatalException do
        Monad::Drivers::YamlDriver.new('path' => 'nonexistfile')
      end
    end

    should 'load valid yaml file' do
      assert_nothing_raised FatalException do
        members = Monad::Drivers::YamlDriver.new('path' => File.join(@base, 'members.yaml')).load

        assert_equal members.size, 2
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
monad-0.0.2 test/test_yaml_driver.rb
monad-0.0.1 test/test_yaml_driver.rb