|
|
@@ -0,0 +1,27 @@
|
|
|
+# frozen_string_literal: true
|
|
|
+
|
|
|
+require 'rails_helper'
|
|
|
+
|
|
|
+RSpec.describe '/api', type: :routing do
|
|
|
+ context 'graphql' do
|
|
|
+ it 'routes to the GraphqlController' do
|
|
|
+ expect(post('/api/graphql')).to route_to(
|
|
|
+ controller: 'api/graphql',
|
|
|
+ action: 'execute',
|
|
|
+ formats: :json,
|
|
|
+ )
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ context 'all other paths' do
|
|
|
+ it 'routes to application#not_found' do
|
|
|
+ path = Faker::Lorem.word
|
|
|
+ expect(post("/api/#{path}")).to route_to(
|
|
|
+ controller: 'api/application',
|
|
|
+ action: 'not_found',
|
|
|
+ formats: :json,
|
|
|
+ path: path,
|
|
|
+ )
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|