Sha256: f136333e4961cec44bd0a973dd1e1d6687ac938ea005176e5445e4805b8b055e

Contents?: true

Size: 835 Bytes

Versions: 4

Compression:

Stored size: 835 Bytes

Contents

require 'helper'

describe Kookaburra::TestData do
  describe '.set_default' do
    it 'stores data that can be used as defaults for tests' do
      Kookaburra::TestData.set_default(:foo, 'bar')
      td = Kookaburra::TestData.new
      assert_equal 'bar', Kookaburra::TestData.default(:foo)
    end
  end

  describe '#default' do
    it 'does not allow default to change between instances' do
      Kookaburra::TestData.set_default(:foo, 'bar' => 'baz')
      td1 = Kookaburra::TestData.new
      td1.default(:foo)['bar'] = 'spam'
      td2 = Kookaburra::TestData.new
      assert_equal 'baz', td2.default(:foo)['bar']
    end

    it 'raises an IndexError if the requested default has not been defined' do
      td = Kookaburra::TestData.new
      assert_raises IndexError do
        td.default(:foobar)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kookaburra-0.14.3 test/kookaburra/test_data_test.rb
kookaburra-0.14.2 test/kookaburra/test_data_test.rb
kookaburra-0.14.1 test/kookaburra/test_data_test.rb
kookaburra-0.14.0 test/kookaburra/test_data_test.rb