Sha256: 455bdac3ebda69a2d0fd53c3184042c96a582f3ee5c7d40403e2ba5937c76a69

Contents?: true

Size: 1.23 KB

Versions: 11

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

shared_examples "export survey user answers" do
  let!(:survey_questions) { create_list :survey_question, 3, survey: survey }
  let!(:survey_answers) do
    survey_questions.map do |question|
      create_list :survey_answer, 3, survey: survey, question: question
    end.flatten
  end

  around do |example|
    perform_enqueued_jobs do
      example.run
    end
  end

  it "exports a CSV" do
    visit_feature_admin

    find(".exports.dropdown").click
    click_link "CSV"

    within ".callout.success" do
      expect(page).to have_content("in progress")
    end

    expect(last_email.subject).to include("survey_user_answers", "csv")
    expect(last_email.attachments.length).to be_positive
    expect(last_email.attachments.first.filename).to match(/^survey_user_answers.*\.zip$/)
  end

  it "exports a JSON" do
    visit_feature_admin

    find(".exports.dropdown").click
    click_link "JSON"

    within ".callout.success" do
      expect(page).to have_content("in progress")
    end

    expect(last_email.subject).to include("survey_user_answers", "json")
    expect(last_email.attachments.length).to be_positive
    expect(last_email.attachments.first.filename).to match(/^survey_user_answers.*\.zip$/)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
decidim-0.6.8 decidim-surveys/spec/shared/export_survey_user_answers_examples.rb
decidim-0.6.7 decidim-surveys/spec/shared/export_survey_user_answers_examples.rb
decidim-0.6.6 decidim-surveys/spec/shared/export_survey_user_answers_examples.rb
decidim-0.6.5 decidim-surveys/spec/shared/export_survey_user_answers_examples.rb
decidim-0.6.4 decidim-surveys/spec/shared/export_survey_user_answers_examples.rb
decidim-0.6.3 decidim-surveys/spec/shared/export_survey_user_answers_examples.rb
decidim-0.6.2 decidim-surveys/spec/shared/export_survey_user_answers_examples.rb
decidim-0.6.1 decidim-surveys/spec/shared/export_survey_user_answers_examples.rb
decidim-0.6.0 decidim-surveys/spec/shared/export_survey_user_answers_examples.rb
decidim-0.5.1 decidim-surveys/spec/shared/export_survey_user_answers_examples.rb
decidim-0.5.0 decidim-surveys/spec/shared/export_survey_user_answers_examples.rb