lib/api_taster/route.rb in api_taster-0.4.1 vs lib/api_taster/route.rb in api_taster-0.4.2
- old
+ new
@@ -8,10 +8,14 @@
class << self
def routes
_routes = []
i = -1
+ unless route_set.respond_to?(:routes)
+ raise ApiTaster::Exception.new('Route definitions are missing, have you defined ApiTaster.routes?')
+ end
+
route_set.routes.each do |route|
next if route.app.is_a?(Sprockets::Environment)
next if route.app == ApiTaster::Engine
if (rack_app = discover_rack_app(route.app)) && rack_app.respond_to?(:routes)
@@ -49,15 +53,11 @@
end
inputs[route[:id]].collect { |input| split_input(input, route) }
end
- def calculate_missing_definitions
- routes.each do |route|
- if undefined_route?(route)
- self.missing_definitions << route
- end
- end
+ def missing_definitions
+ routes.select { |route| undefined_route?(route) }
end
private
def undefined_route?(route)