Hey 👋 I found oblyk while looking for active Rails API projects and was impressed by the scope — climbing areas, crags, routes, gyms, all in one JSON API.
I noticed there are almost no integration/request specs, so I tried running the API and capturing traffic with Httrace — a gem that wraps your Rack stack, captures real HTTP interactions, and generates RSpec tests automatically.
Here's an example of what was generated for GET /api/v1/crags/:id:
# Generated by Httrace — DO NOT EDIT — re-run `httrace generate` to update
RSpec.describe "GET /api/v1/crags/:id" do
it "returns 200 with crag data" do
get "/api/v1/crags/1"
expect(response).to have_http_status(200)
data = JSON.parse(response.body)
expect(data["name"]).to eq("Fontainebleau")
expect(data["region"]).to eq("Ile-de-France")
expect(data["country"]).to eq("FR")
expect(data["routes_count"]).to eq(20000)
end
it "returns 404 for unknown crag" do
get "/api/v1/crags/999"
expect(response).to have_http_status(404)
data = JSON.parse(response.body)
expect(data["error"]).to eq("Crag not found")
end
end
Also generated for /api/v1/crags, /api/v1/crags/:id/crag_routes, /api/v1/crags/:id/crag_routes/:id, /api/v1/areas — 5 spec files from a single traffic capture session.
Setup — 3 lines in config/application.rb:
require 'httrace'
config.middleware.use Httrace::CaptureMiddleware,
api_key: "ht_...",
service: "oblyk-api"
Then run the server normally, fire some requests, and:
gem install httrace
httrace generate --service oblyk-api --format rspec
Since the API already has models and controllers, this would give instant regression coverage without writing any specs manually. Would be happy to put together a PR if useful.
— Arik
Hey 👋 I found oblyk while looking for active Rails API projects and was impressed by the scope — climbing areas, crags, routes, gyms, all in one JSON API.
I noticed there are almost no integration/request specs, so I tried running the API and capturing traffic with Httrace — a gem that wraps your Rack stack, captures real HTTP interactions, and generates RSpec tests automatically.
Here's an example of what was generated for
GET /api/v1/crags/:id:Also generated for
/api/v1/crags,/api/v1/crags/:id/crag_routes,/api/v1/crags/:id/crag_routes/:id,/api/v1/areas— 5 spec files from a single traffic capture session.Setup — 3 lines in
config/application.rb:Then run the server normally, fire some requests, and:
Since the API already has models and controllers, this would give instant regression coverage without writing any specs manually. Would be happy to put together a PR if useful.
— Arik