- I am using apivore in a separate(custom) test framework.
- So apivore is not used with a rails app. i am just testing some rest APIs
- i had to override follwing method to return the swagger.json file located (temp) in my framework
def fetch_swagger!
JSON.parse(File.read(LOCAL_SWAGGER_JSON_PATH))
end
here is my test:
describe 'the API', type: :apivore, order: :defined do
before do
byebug
@json = Apivore::SwaggerChecker.instance_for(LOCAL_SWAGGER_JSON_PATH)
end
context 'testing' do
let(:params){}
it 'identify' do
expect(@json).to validate(
:post, "/identify", 200, {
"_data" => {user_id: 'xxx', email: "test@test.com"},
"_headers" => {'X-Outbound-Key' => 'xxxx'}
}
)
end
end
end
Error after executing test:
Failure/Error:
expect(@json).to validate(
:post, "/identify", 200, {
"_data" => {user_id: 'xxx', email: "test@test.com"},
"_headers" => {'X-Outbound-Key' => 'xxx'}
}
)
NoMethodError:
undefined method `call' for nil:NilClass
How can i user Apivore:
- with non rails app?
- by loading local swagger.json file?
here is my test:
Error after executing test:
How can i user Apivore: