Sha256: 49b3a7cb4c4bd3d48c9075ab6404832bda1ad7f1000fb6df17ceb1e5783bc48b

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

module JSON
  describe Generator do
    describe '.generate' do
      let(:attribute) { double('attribute') }
      let(:schema) { double('schema') }
      let(:dereferenced_schema) { double('dereferenced schema') }
      let(:generated_json) { double('generated json') }

      it 'should dereference a given schema and generate valid JSON for it' do
        JSON::Generator::Dereferencer.should_receive(:dereference).
          with(schema).
          and_return(dereferenced_schema)
        Generator::AttributeFactory.should_receive(:create).with(dereferenced_schema).and_return(attribute)
        attribute.should_receive(:generate).and_return(generated_json)

        described_class.generate(schema).should == generated_json
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
json-generator-0.0.1 spec/json/generator_spec.rb
contracts_api_test-0.0.1 spec/json/generator_spec.rb