Skip to content

Commit 23eb9d2

Browse files
committed
fix specs
1 parent d5ef393 commit 23eb9d2

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

spec/system/admin/report_and_hide_proposals_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ def component_path
3232
expect(page).to have_content(proposal.title["en"])
3333

3434
click_on("Report")
35-
within ".modal__report" do
35+
within ".flag-modal" do
3636
click_on("Report")
3737
end
3838

39+
expect(page).to have_content(proposal.title["en"])
40+
expect(page).to have_content("The report has been created successfully and it will be reviewed by an admin.")
3941
expect(proposal.reload).not_to be_hidden
4042
expect(proposal).to be_reported
41-
expect(page).to have_content(proposal.title["en"])
42-
expect(page).to have_no_button("Report")
43+
visit component_path
4344
expect(page).to have_link("Hide")
4445

4546
click_on "Hide"

spec/system/reporting_proposals_spec.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
login_as user, scope: :user
3737
end
3838

39-
def fill_proposal(extra_fields: true, skip_address: false, skip_group: false, skip_scope: false, attach: false)
39+
def fill_proposal(extra_fields: true, skip_address: false, skip_group: false, skip_scope: false, attach: false, submit: true)
4040
within "#content" do
4141
fill_in :proposal_title, with: proposal_title
4242
fill_in :proposal_body, with: proposal_body
@@ -51,16 +51,17 @@ def fill_proposal(extra_fields: true, skip_address: false, skip_group: false, sk
5151

5252
check "proposal_has_no_address" if skip_address
5353
end
54-
5554
if attach
5655
dynamically_attach_file(:proposal_add_photos, Decidim::Dev.asset("city.jpeg"))
5756
dynamically_attach_file(:proposal_documents, Decidim::Dev.asset("Exampledocument.pdf"))
5857
elsif manifest_name == "reporting_proposals"
5958
check "proposal_has_no_image"
6059
end
6160

62-
within "#content" do
63-
find("*[type=submit]").click
61+
if submit
62+
within "#content" do
63+
find("*[type=submit]").click
64+
end
6465
end
6566
end
6667

spec/system/shared/proposals_steps_examples.rb

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
shared_examples "map can be shown" do |fill|
1616
it "checkbox shows the map" do
17-
fill_proposal(extra_fields: false) if fill
17+
fill_proposal(extra_fields: false, submit: false) if fill
1818

1919
expect(page).to have_no_content("You can move the point on the map")
2020

@@ -124,13 +124,14 @@
124124

125125
expect(page).to have_content("Edit proposal draft")
126126

127-
expect(page).to have_content("Image")
128-
expect(page).to have_content("Documents")
129-
130-
click_on "Publish"
127+
expect(page).to have_content("Image/photo")
128+
expect(page).to have_content("Add documents")
129+
check "proposal_has_no_image"
130+
select translated(another_category.name), from: :proposal_category_id
131+
click_on "Preview"
131132

132133
expect(page).to have_content(proposal_title)
133-
expect(translated(proposal.body)).to have_content(proposal_body)
134+
expect(page).to have_content(proposal_body)
134135
expect(proposal.category).to eq(another_category)
135136
end
136137

@@ -184,15 +185,6 @@
184185
expect(page).to have_unchecked_field("proposal_has_no_address")
185186
expect(page).to have_css("label[for=proposal_address].is-invalid-label")
186187
end
187-
188-
it "has errors in photo address field" do
189-
expect(page).to have_no_css("label[for=proposal_add_photos].is-invalid-label")
190-
191-
uncheck "proposal_has_no_image"
192-
193-
click_on "Send"
194-
expect(page).to have_css("label[for=proposal_add_photos].is-invalid-label")
195-
end
196188
end
197189

198190
shared_examples "normal form" do
@@ -219,8 +211,6 @@
219211

220212
expect(page).to have_content(proposal_title)
221213
expect(translated(proposal.body)).to eq(proposal_body)
222-
expect(proposal.category).to eq(another_category)
223-
expect(proposal.identities.first).to eq(user_group)
224214
end
225215
end
226216

0 commit comments

Comments
 (0)