Use find instead of find_by_id
Better raise a 404 HTML NotFound exception than any other unexpected error.
This commit is contained in:
committed by
Javi Martín
parent
22076dd95c
commit
b122302c58
@@ -11,6 +11,30 @@ describe "Valuation budget investments" do
|
||||
login_as(valuator.user)
|
||||
end
|
||||
|
||||
context "Load" do
|
||||
|
||||
before { budget.update(slug: "budget_slug") }
|
||||
|
||||
scenario "finds investment using budget slug" do
|
||||
visit valuation_budget_budget_investments_path("budget_slug")
|
||||
|
||||
expect(page).to have_content budget.name
|
||||
end
|
||||
|
||||
scenario "raises an error if budget slug is not found" do
|
||||
expect do
|
||||
visit valuation_budget_budget_investments_path("wrong_budget")
|
||||
end.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
scenario "raises an error if budget id is not found" do
|
||||
expect do
|
||||
visit valuation_budget_budget_investments_path(0)
|
||||
end.to raise_error ActiveRecord::RecordNotFound
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
scenario "Disabled with a feature flag" do
|
||||
Setting["process.budgets"] = nil
|
||||
expect{
|
||||
|
||||
Reference in New Issue
Block a user