Skip to content

Commit

Permalink
Fix mistake in preview + refactor test
Browse files Browse the repository at this point in the history
  • Loading branch information
armandfardeau committed Nov 8, 2018
1 parent a571342 commit b845f3c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Expand Up @@ -42,8 +42,6 @@
</div>
<% end %>
<% end %>
<div class="card__content">
<%= render partial: "proposal_preview", locals: {proposal: @proposal} %>
<div class="row column flex-center">
<%= link_to t(".modify"), edit_draft_proposal_path(@proposal) %>
Expand Down
8 changes: 4 additions & 4 deletions decidim-proposals/spec/shared/proposals_wizards_examples.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true

shared_examples "proposals wizards" do |with_address|
shared_examples "proposals wizards" do |options|
include_context "with a component"
let(:manifest_name) { "proposals" }

Expand All @@ -19,7 +19,7 @@
participatory_space: participatory_process)
end

if with_address
if options == :with_address
let(:proposal_address) { "Carrer Pare Llaurador 113, baixos, 08224 Terrassa" }
let(:latitude) { 40.1234 }
let(:longitude) { 2.1234 }
Expand Down Expand Up @@ -152,7 +152,7 @@
Decidim::EngineRouter.main_proxy(component).proposal_path(proposal_draft) + "/preview"
end

if with_address
if options == :with_address
let!(:proposal_draft) do
create(:proposal, :draft, author: user, component: component, title: proposal_title, body: proposal_body, address: proposal_address)
end
Expand All @@ -172,7 +172,7 @@

it "shows a preview" do
expect(page).to have_css(".card.card--proposal", count: 1)
if with_address
if options == :with_address
expect(page).to have_content("Your address has not been geocoded, preview is unavailable.")
expect(page).to have_content("Address : #{proposal_address}")
end
Expand Down
2 changes: 1 addition & 1 deletion decidim-proposals/spec/system/proposal_wizard_spec.rb
Expand Up @@ -4,5 +4,5 @@

describe "Proposal", type: :system do
it_behaves_like "proposals wizards"
it_behaves_like "proposals wizards", true
it_behaves_like "proposals wizards", :with_address
end

0 comments on commit b845f3c

Please sign in to comment.