Sha256: bcf957eec61fab4cc6a2b8af64f53261010a1d60139ab730cedab4fd537a2050

Contents?: true

Size: 986 Bytes

Versions: 9

Compression:

Stored size: 986 Bytes

Contents

require 'kookaburra/test_data'

describe Kookaburra::TestData do
  describe '#method_missing' do
    it 'returns a Collection' do
      subject.foo.should be_kind_of(Kookaburra::TestData::Collection)
    end

    it 'returns different Collections for different messages' do
      subject.foo.should_not === subject.bar
    end
  end

  describe Kookaburra::TestData::Collection do
    let(:collection) { Kookaburra::TestData::Collection.new('widgets') }

    describe '#slice' do
      it 'returns an array of items matching the specified keys' do
        collection[:foo] = 'foo'
        collection[:bar] = 'bar'
        collection[:baz] = 'baz'
        collection.slice(:foo, :baz).should == %w(foo baz)
      end
    end

    it 'raises a Kookaburra::UnknownKeyError exception for #[] with a missing key' do
      lambda { collection[:foo] }.should \
        raise_error(Kookaburra::UnknownKeyError, "Can't find test_data.widgets[:foo]. Did you forget to set it?")
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kookaburra-0.18.3 spec/kookaburra/test_data_spec.rb
kookaburra-0.18.2 spec/kookaburra/test_data_spec.rb
kookaburra-0.18.1 spec/kookaburra/test_data_spec.rb
kookaburra-0.18.0 spec/kookaburra/test_data_spec.rb
kookaburra-0.17.1 spec/kookaburra/test_data_spec.rb
kookaburra-0.17.0 spec/kookaburra/test_data_spec.rb
kookaburra-0.16.1 spec/kookaburra/test_data_spec.rb
kookaburra-0.16.0 spec/kookaburra/test_data_spec.rb
kookaburra-0.15.1 spec/kookaburra/test_data_spec.rb