Sha256: 7a2aa1a61c6d9bb5acb9c815ab80fb330ff6759894a1fbd098537f4cff83fdf5

Contents?: true

Size: 909 Bytes

Versions: 6

Compression:

Stored size: 909 Bytes

Contents

require 'spec_helper'

describe 'expect path' do 

	describe "errors" do
		before :each do
			mock_get('array_with_index')
			get '/array_with_index'
		end

		it "should raise PathError when incorrect path containing .. is used" do 
			expect do
				expect_json('cars..make', "Tesla")
			end.to raise_error(Airborne::PathError, "Invalid Path, contains '..'")
		end

		it "should raise PathError when trying to call property on an array" do
			expect do
				expect_json('cars.make', "Tesla")
			end.to raise_error(Airborne::PathError, "Expected Array\nto to be an object with property make")
		end
	end

	it "should work with numberic properties" do 
		mock_get('numeric_property')
		get '/numeric_property'
		expect_json('cars.0.make', "Tesla")
	end

	it "should work with numberic properties" do 
		mock_get('numeric_property')
		get '/numeric_property'
		expect_json_keys('cars.0',[:make, :model])
	end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
airborne-0.1.15 spec/airborne/path_spec.rb
airborne-0.1.14 spec/airborne/path_spec.rb
airborne-0.1.13 spec/airborne/path_spec.rb
airborne-0.1.12 spec/airborne/path_spec.rb
airborne-0.1.11 spec/airborne/path_spec.rb
airborne-0.1.10 spec/airborne/path_spec.rb