Sha256: 05be65f9dfa57ee87bf0d9c96a0f8da8923f54a0a29fe1cb4e4a9eaa14d90e79
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
module JSON module Generator describe ArrayAttribute do it 'should be a BasicAttribute' do described_class.new(nil).should be_a_kind_of(BasicAttribute) end describe '#generate' do context 'with minItems' do it 'should generate an array with two objects of the expected type' do stubbed_item = stub('item', :generate => 'foo') AttributeFactory.should_receive(:create).twice. with('type' => 'dummy_type'). and_return(stubbed_item) properties = { 'type' => 'array', 'minItems' => 2, 'items' => { 'type' => 'dummy_type' } } described_class.new(properties).generate.should == [stubbed_item.generate, stubbed_item.generate] end end context 'without minItems' do it 'should generate an empty array' do properties = { 'type' => 'array', 'items' => { 'type' => 'dummy_type' } } described_class.new(properties).generate.should == [] end end end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
json-generator-0.0.1 | spec/json/generator/array_attribute_spec.rb |
contracts_api_test-0.0.1 | spec/json/generator/array_attribute_spec.rb |