diff --git a/Gemfile.lock b/Gemfile.lock index 6629bac9bd..2d871084df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1071,7 +1071,7 @@ GEM websocket-extensions (0.1.5) wicked (1.4.0) railties (>= 3.0.7) - wicked_pdf (2.7.0) + wicked_pdf (2.6.3) activesupport wisper (2.0.1) wisper-rspec (1.1.0) diff --git a/spec/system/admin/export_initiative_signatures_spec.rb b/spec/system/admin/export_initiative_signatures_spec.rb new file mode 100644 index 0000000000..f9fe060c5e --- /dev/null +++ b/spec/system/admin/export_initiative_signatures_spec.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +require "spec_helper" + +describe "Export" do + include_context "when admins initiative" + + let!(:votes) { create_list(:initiative_user_vote, 5, initiative: initiative) } + + before do + switch_to_host(organization.host) + login_as user, scope: :user + end + + it "downloads the PDF file", :download do + visit decidim_admin_initiatives.initiatives_path + + within find("tr", text: translated(initiative.title)) do + page.find(".action-icon--edit").click + end + + click_link "Export PDF of signatures" + within ".confirm-reveal" do + click_link "OK" + end + + expect(File.basename(download_path)).to include("votes_#{initiative.id}.pdf") + end +end