Sha256: ea6dc7115c9c67ad097076eab642eb3fc9f518a96ddfa708e638cd6679a1c3d1
Contents?: true
Size: 1.32 KB
Versions: 11
Compression:
Stored size: 1.32 KB
Contents
require 'em-synchrony' require 'spec_helper' describe AgileProxy::Response do it 'Should have many requests ' do expect(subject).to have_many(:request_specs) end it 'Should serialize the headers in json format' do expect(subject).to serialize(:headers) end describe 'With a configured delay' do before :each do subject.delay = 0.5 subject.content = 'Test' subject.content_type = 'text/plain' end it 'Should respond with a delay using the Em::Synchrony.sleep method' do expect(EventMachine::Synchrony).to receive(:sleep).with(0.5) expect(subject.to_rack({}, {}, '')).to eql([200, { 'Content-Type' => 'text/plain' }, 'Test']) end end describe 'Using templates' do describe 'Using text' do before :each do subject.is_template = true subject.content = 'Hello {{name}}' subject.content_type = 'text/plain' end it 'Should pass the params to the template and the output should be correct' do expect(subject.to_rack({ name: 'World' }, {}, '')).to eql([200, { 'Content-Type' => 'text/plain' }, 'Hello World']) end it 'Should deal with if a parameter is missing' do expect(subject.to_rack({}, {}, '')).to eql([500, { 'Content-Type' => 'text/plain' }, "Missing var or method 'name' in data."]) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems