Show results and stats settings only in budget edit view

This commit is contained in:
decabeza
2020-03-17 13:12:09 +01:00
committed by Javi Martín
parent f27c0f46c3
commit f685020fd0
2 changed files with 22 additions and 1 deletions

View File

@@ -88,7 +88,9 @@
<% end %>
</fieldset>
<% if @budget.persisted? %>
<%= render "admin/shared/show_results_fields", form: f %>
<% end %>
<div class="small-12 column">
<div class="clear small-12 medium-4 large-3 inline-block">

View File

@@ -144,6 +144,15 @@ describe "Admin budgets", :admin do
expect(page).to have_css(".is-invalid-label", text: "Name")
expect(page).to have_css("small.form-error", text: "has already been taken")
end
scenario "Do not show results and stats settings on new budget", :js do
visit new_admin_budget_path
expect(page).not_to have_content "Show results and stats"
expect(page).not_to have_field "Show results"
expect(page).not_to have_field "Show stats"
expect(page).not_to have_field "Show advanced stats"
end
end
context "Destroy" do
@@ -216,6 +225,16 @@ describe "Admin budgets", :admin do
end
end
scenario "Show results and stats settings", :js do
visit edit_admin_budget_path(budget)
within_fieldset "Show results and stats" do
expect(page).to have_field "Show results"
expect(page).to have_field "Show stats"
expect(page).to have_field "Show advanced stats"
end
end
scenario "Changing name for current locale will update the slug if budget is in draft phase", :js do
budget.update!(phase: "drafting")
old_slug = budget.slug