fixes for api test docs

pull/1630/head
gabrielburnworth 2019-12-18 07:22:44 -08:00
parent edff93a66d
commit 6ba8d6612d
2 changed files with 11 additions and 5 deletions

View File

@ -10,13 +10,17 @@ describe DashboardController do
expect(response.status).to eq(200)
end
it "renders the terms of service" do
it "renders the front page" do
get :front_page
expect(response.status).to eq(200)
# first entry in api_docs.md
SmarfDoc.note("Documentation generated for the " +
"[FarmBot Web App](https://github.com/FarmBot/Farmbot-Web-App).")
end
it "renders the terms of service" do
expect { get :main_app, params: { path: "nope.jpg" } }.to raise_error(ActionController::RoutingError)
it "returns error on invalid path" do
expect { get :main_app, params: { path: "nope.jpg" } }
.to raise_error(ActionController::RoutingError)
end
it "receives CSP violation reports (malformed JSON)" do
@ -26,7 +30,7 @@ describe DashboardController do
expect(json).to eq(problem: "Crashed while parsing report")
end
it "receives CSP violation reports (malformed JSON)" do
it "receives CSP violation reports (JSON)" do
post :csp_reports, body: {}.to_json, params: { format: :json }
expect(json).to eq({})
end

View File

@ -83,7 +83,9 @@ RSpec.configure do |config|
config.order = "random"
if ENV["DOCS"]
config.after(:each, type: :controller) do
SmarfDoc.run!(NiceResponse.new(request), response)
if request.path.length > 0 || response.body.length > 0
SmarfDoc.run!(NiceResponse.new(request), response)
end
end
config.after(:suite) do