Sha256: a89aade57fe9313abad9595054fb38b4a25d4e9f8f08fd8485db96852a6f75a4
Contents?: true
Size: 1.49 KB
Versions: 7
Compression:
Stored size: 1.49 KB
Contents
require 'spec_helper' describe Xcal::Parktronic::GenericResponse do context 'initialization' do let(:valid_generic_response) do Xcal::Parktronic::GenericResponse.new( { :first_argument => 'first', :second_argument => 'second', :nil_argument => nil, :boolean_argument => false } ) end it 'should initialize correctly and raise appropriate errors' do expect do Xcal::Parktronic::GenericResponse.new end.to raise_error(Xcal::Parktronic::Exceptions::InvalidResponseArgument, /without raw response/) expect do Xcal::Parktronic::GenericResponse.new('d') end.to raise_error(Xcal::Parktronic::Exceptions::InvalidResponseArgument, /should be a Hash/) expect do Xcal::Parktronic::GenericResponse.new('{"key":"value"}') end.not_to raise_error expect(Xcal::Parktronic::GenericResponse.new('{"key":"value"}').key).to eql('value') expect{ Xcal::Parktronic::GenericResponse.new({}) }.not_to raise_error end it 'should have a valid set of http arguments' do expect(valid_generic_response.first_argument).to eql('first') expect(valid_generic_response.second_argument).to eql('second') expect(valid_generic_response.nil_argument).to eql(nil) expect(valid_generic_response.boolean_argument).to eql(false) expect{ valid_generic_response.missing_argument }.to raise_error(NoMethodError, /undefined method/) end end end
Version data entries
7 entries across 7 versions & 1 rubygems