Farmbot-Web-App/spec/controllers/dashboard_spec.rb

35 lines
983 B
Ruby
Raw Normal View History

2017-08-14 14:34:04 -06:00
require 'spec_helper'
describe DashboardController do
include Devise::Test::ControllerHelpers
describe 'dashboard endpoint' do
2017-09-01 13:58:24 -06:00
it "renders the terms of service" do
2017-09-01 14:13:37 -06:00
get :tos_update
2017-09-01 13:58:24 -06:00
expect(response.status).to eq(200)
2017-09-20 09:26:48 -06:00
end
it "renders the terms of service" do
get :front_page
expect(response.status).to eq(200)
end
it "renders the terms of service" do
expect { get :main_app, params: {path: "nope.jpg"} }
.to raise_error(ActionController::RoutingError)
2017-09-01 13:58:24 -06:00
end
2018-01-13 09:12:28 -07:00
it "receives CSP violation reports (malformed JSON)" do
expect(Rollbar).to receive(:error)
.with("CSP VIOLATION!!!", {problem: "Crashed while parsing report"})
post :csp_reports, body: "NOT JSON ! ! !"
end
it "receives CSP violation reports (malformed JSON)" do
expect(Rollbar).to receive(:error)
.with("CSP VIOLATION!!!", {})
post :csp_reports, body: {}.to_json, params: {format: :json}
end
2017-08-14 14:34:04 -06:00
end
end