Sha256: b0a22ab5560ac0c01e692ecb7646089bb282a7557fd875fda6f77dd549b0d0c2
Contents?: true
Size: 1.48 KB
Versions: 4
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' module RubyAMI describe AGIResultParser do subject { described_class.new result_string } context 'with something that does not match the valid format' do let(:result_string) { 'foobar' } it 'should raise ArgumentError on creation' do expect { subject }.to raise_error(ArgumentError, /format/) end end context 'with a simple result with no data' do let(:result_string) { "200%20result=123%0A" } its(:code) { should == 200 } its(:result) { should == 123 } its(:data) { should == '' } its(:data_hash) { should == nil } end context 'with a simple unescaped result with no data' do let(:result_string) { "200 result=123" } its(:code) { should == 200 } its(:result) { should == 123 } its(:data) { should == '' } its(:data_hash) { should == nil } end context 'with a result and data in parens' do let(:result_string) { "200%20result=-123%20(timeout)%0A" } its(:code) { should == 200 } its(:result) { should == -123 } its(:data) { should == 'timeout' } its(:data_hash) { should == nil } end context 'with a result and key-value data' do let(:result_string) { "200%20result=123%20foo=bar%0A" } its(:code) { should == 200 } its(:result) { should == 123 } its(:data) { should == 'foo=bar' } its(:data_hash) { should == {'foo' => 'bar'} } end end end
Version data entries
4 entries across 4 versions & 1 rubygems