Sha256: f139030b7251f5a083cd3dfa015fce85ea9507f91cdf71431729fe1652c1dabc
Contents?: true
Size: 1.05 KB
Versions: 5
Compression:
Stored size: 1.05 KB
Contents
shared_examples 'a response' do let(:child_name) do response.xml.children.first.name end describe '#find' do it 'returns an Array of matches' do response.find(child_name).should_not be_empty end it 'yields matches to a block' do yielded = false response.find(child_name) { yielded = true } yielded.should be_true end it 'is aliased to []' do response.find(child_name).should eql response[child_name] end end describe '#to_hash' do it 'casts response to a hash' do response.to_hash.should be_a Hash end end describe '#valid?' do context 'when HTTP status is OK' do it 'returns true' do response.should be_valid end end context 'when HTTP status is not OK' do before do response.code = 403 end it 'returns false' do response.should_not be_valid end end end describe '#xml' do it 'returns a Nokogiri document' do response.xml.should be_an_instance_of Nokogiri::XML::Document end end end
Version data entries
5 entries across 5 versions & 1 rubygems