Skip to content

Commit

Permalink
Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasAapro committed Jul 25, 2024
1 parent 7e6100e commit fb88102
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
3 changes: 1 addition & 2 deletions app/helpers/decidim/plans/attachments_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def upload_field(form, attribute)
template = ""
template += form.label(attribute, label_content)
template += form.file_field attribute, label: false

file_path = form.object.attached_uploader(attribute).url
file_path = form.object.attached_uploader(attribute).path
if form.send(:file_is_image?, file)
template += if file.present?
content_tag :label, I18n.t("current_image", scope: "decidim.forms")
Expand Down
2 changes: 1 addition & 1 deletion spec/cells/decidim/plans/attachments_cell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
expect(subject).to have_content(translated(doc.title))
end
images.each do |img|
expect(subject).to have_css(%(img[alt="#{translated(img.title)}"]))
expect(subject).to have_css("img[alt='#{translated(img.title)}']")
end
end
end
Expand Down
1 change: 0 additions & 1 deletion spec/cells/decidim/plans/author_cell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
let(:my_cell) { cell("decidim/plans/author", model, from: plan) }

it "renders the flag button with report modal target" do
puts subject
expect(subject).to have_css("button[data-open='flagModal'][title='Report']")
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ module Admin
describe "#target_components_collection" do
it "returns a collection of the budgets components for form select" do
expect(subject.target_components_collection).to contain_exactly(
["Budgets", target_component.id]
[target_component.name["en"], target_component.id]
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/decidim/plans/attachments_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
it "returns the correct output" do
output = ctx.upload_field(form, attribute)
expect(output).to have_css("label[for='object_test']:contains(Test)")
expect(output).to have_field("[type='file'][name='object[test]']")
expect(output).to have_selector("input[type='file'][name='object[test]']")
end

context "when image file is set" do
Expand Down
11 changes: 4 additions & 7 deletions spec/system/explore_plans_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with_versioning do
let(:component) { create(:plan_component, :with_creation_enabled) }
let(:organization) { component.organization }
let(:user) { create(:user, :confirmed, :admin, organization:) }
let!(:user) { create(:user, :confirmed, :admin, organization:) }
let!(:plans) { create_list(:plan, 10, component:) }
let!(:evaluating) { create_list(:plan, 5, :evaluating, component:) }
let!(:rejected) { create_list(:plan, 3, :rejected, component:) }
Expand Down Expand Up @@ -91,7 +91,7 @@
click_on "Continue your proposal"
fill_in "contents[#{plan.sections.first.id}][body_en]", with: "Update text"
click_on "Preview"
expect(page).to have_content("VERSION 2 (of 2)")
expect(page).to have_content("Version 2 (of 2)")
click_on "Edit"
expect(page).to have_current_path(decidim_plan.edit_plan_path(plan.id))
end
Expand Down Expand Up @@ -128,7 +128,7 @@
expect(page).to have_field("contents[#{section.id}][body_en]")
expect(page).to have_link("Back to proposals list")
click_on "Preview"
expect(page).to have_content("There's an error in this field")
expect(page).to have_content("There is an error in this field")
fill_in "contents[#{section.id}][body_en]", with: "Dummy text"
click_on "Save as draft"
expect(page).to have_content("Created successfully.")
Expand Down Expand Up @@ -189,10 +189,7 @@
end

context "with published plan" do
before do
plan.update!(published_at: Time.current)
visit current_path
end
let!(:plan) { create(:plan, :published, component:, users: [user]) }

it "show/edits authors" do
expect(page).to have_button("Add authors for proposal")
Expand Down

0 comments on commit fb88102

Please sign in to comment.