Skip to content

Commit

Permalink
improve homepage_content_block_spec for assemblies
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbeig committed Oct 18, 2024
1 parent c2c19fe commit 9a894e1
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion decidim-assemblies/spec/system/homepage_content_blocks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
let!(:promoted_assembly) { create(:assembly, :promoted, organization:) }
let!(:unpromoted_assembly) { create(:assembly, organization:) }
let!(:promoted_external_assembly) { create(:assembly, :promoted) }
let!(:highlighted_assemblies_content_block) {
create(:content_block, organization:, scope_name: :homepage, manifest_name: :highlighted_assemblies)
}

include_context "when admin administrating an assembly"

before do
create(:content_block, organization:, scope_name: :homepage, manifest_name: :highlighted_assemblies)
switch_to_host(organization.host)
login_as user, scope: :user
end


it "includes active assemblies to the homepage" do
visit decidim.root_path

Expand All @@ -22,4 +28,22 @@
expect(page).not_to have_i18n_content(promoted_external_assembly.title)
end
end

it "updates the settings of the content block" do
visit decidim_admin.edit_organization_homepage_content_block_path(highlighted_assemblies_content_block)

expect(find("input[type='number'][name='content_block[settings][max_results]").value).to eq("6")

fill_in "content_block[settings][max_results]", with: "1"
click_on "Update"

expect(page).to have_content("Highlighted assemblies")
expect(highlighted_assemblies_content_block.reload.settings["max_results"]).to eq(1)

visit decidim.root_path

within "#highlighted-assemblies" do
expect(page).to have_css("a.card__grid", count: 1)
end
end
end

0 comments on commit 9a894e1

Please sign in to comment.