Sha256: f96fe866b1624fc716ef1e075ff1962778e4d1a93532bb5e8c33d4ec28e7f72f
Contents?: true
Size: 1006 Bytes
Versions: 5
Compression:
Stored size: 1006 Bytes
Contents
require 'spec_helper' describe GrapeApiary::SampleGenerator do include_context 'configuration' before do GrapeApiary.config do |config| config.host = host config.name = name config.description = description config.include_root = false end end let(:blueprint) { GrapeApiary::Blueprint.new(SampleApi) } let(:resource) { blueprint.resources.first } subject { GrapeApiary::SampleGenerator.new(resource) } it 'creates a sample hash from a resource' do expect(subject.sample).to be_a(Hash) end context '#request' do it 'creates a sample request in JSON form' do expect { JSON.parse(subject.request) }.to_not raise_error end end context '#response' do it 'creates a sample response in JSON form' do expect { JSON.parse(subject.response) }.to_not raise_error end it 'includes a sample id' do expect(JSON.parse(subject.response)['id']).to_not be(nil) end end end
Version data entries
5 entries across 5 versions & 1 rubygems