diff --git a/Gemfile b/Gemfile
index 4cdfa2256..68f87f943 100644
--- a/Gemfile
+++ b/Gemfile
@@ -8,8 +8,6 @@ gem "ahoy_matey", "~> 1.6.0"
gem "ancestry", "~> 3.0.7"
gem "audited", "~> 4.9.0"
gem "autoprefixer-rails", "~> 8.2.0"
-gem "axlsx", "~> 3.0.0.pre"
-gem "axlsx_rails", "~> 0.5.2"
gem "browser", "~> 2.5.3"
gem "cancancan", "~> 2.3.0"
gem "ckeditor", "~> 4.2.3"
diff --git a/Gemfile.lock b/Gemfile.lock
index e62816e06..dca267cd6 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -76,14 +76,6 @@ GEM
activerecord (>= 4.2, < 6.1)
autoprefixer-rails (8.2.0)
execjs
- axlsx (3.0.0.pre)
- htmlentities (~> 4.3, >= 4.3.4)
- mimemagic (~> 0.3)
- nokogiri (~> 1.8, >= 1.8.2)
- rubyzip (~> 1.2, >= 1.2.1)
- axlsx_rails (0.5.2)
- actionpack (>= 3.1)
- axlsx (>= 2.0.1)
babel-source (5.8.35)
babel-transpiler (0.7.0)
babel-source (>= 4.0, < 6)
@@ -592,8 +584,6 @@ DEPENDENCIES
ancestry (~> 3.0.7)
audited (~> 4.9.0)
autoprefixer-rails (~> 8.2.0)
- axlsx (~> 3.0.0.pre)
- axlsx_rails (~> 0.5.2)
browser (~> 2.5.3)
bullet (~> 5.7.0)
byebug (~> 10.0.0)
diff --git a/app/assets/stylesheets/legislation_process.scss b/app/assets/stylesheets/legislation_process.scss
index a6e76b9b5..cb4488004 100644
--- a/app/assets/stylesheets/legislation_process.scss
+++ b/app/assets/stylesheets/legislation_process.scss
@@ -1006,39 +1006,3 @@
font-weight: bold;
}
}
-
-// 10. Legislation resumes
-// -------------------------
-.resume_title {
- padding-left: 0;
-}
-
-.panel_resume {
- margin-left: rem-calc(16);
-}
-
-.question_title {
- margin-bottom: 1.5%;
-}
-
-.comment_box {
- border-radius: rem-calc(10);
- padding: 1.5%;
- background-color: rgba(217, 216, 243, 0.2);
- margin-bottom: 1%;
-}
-
-.centered_votes {
- padding: rem-calc(10);
-}
-
-.annotation_text {
- border: 1px solid $black;
- padding: rem-calc(10);
-}
-
-.download-button {
- position: absolute;
- margin-top: rem-calc(25);
- margin-left: 85%;
-}
diff --git a/app/controllers/legislation/processes_controller.rb b/app/controllers/legislation/processes_controller.rb
index 96f4fa112..d6dd6d3e5 100644
--- a/app/controllers/legislation/processes_controller.rb
+++ b/app/controllers/legislation/processes_controller.rb
@@ -7,7 +7,6 @@ class Legislation::ProcessesController < Legislation::BaseController
load_and_authorize_resource
before_action :set_random_seed, only: :proposals
- before_action :check_past, only: :resume
def index
@current_filter ||= "open"
@@ -98,21 +97,6 @@ class Legislation::ProcessesController < Legislation::BaseController
@phase = :milestones
end
- def resume
- @phase = :resume
- respond_to do |format|
- format.html
- format.xlsx { render xlsx: "resume_to_xlsx", filename: ("resume-" + Date.current.to_s + ".xlsx") }
- end
- end
-
- def check_past
- set_process
- if !@process.past?
- redirect_to legislation_process_path
- end
- end
-
def proposals
set_process
@phase = :proposals_phase
diff --git a/app/models/abilities/everyone.rb b/app/models/abilities/everyone.rb
index 506032203..6cdc8b6c9 100644
--- a/app/models/abilities/everyone.rb
+++ b/app/models/abilities/everyone.rb
@@ -25,7 +25,6 @@ module Abilities
can :new, DirectMessage
can [:read, :debate, :draft_publication, :allegations, :result_publication,
:proposals, :milestones], Legislation::Process, published: true
- can :resume, Legislation::Process, &:past?
can [:read, :changes, :go_to_version], Legislation::DraftVersion
can [:read], Legislation::Question
can [:read, :map, :share], Legislation::Proposal
diff --git a/app/models/legislation/process.rb b/app/models/legislation/process.rb
index c72333346..873988893 100644
--- a/app/models/legislation/process.rb
+++ b/app/models/legislation/process.rb
@@ -65,10 +65,6 @@ class Legislation::Process < ApplicationRecord
draft_end_date < ?))", Date.current, Date.current)
end
- def past?
- end_date < Date.current
- end
-
def homepage_phase
Legislation::Process::Phase.new(start_date, end_date, homepage_enabled)
end
@@ -123,20 +119,6 @@ class Legislation::Process < ApplicationRecord
end
end
- def get_last_draft_version
- Legislation::DraftVersion.where(process: self, status: "published").last
- end
-
- def get_annotations_from_draft
- Legislation::Annotation.where(legislation_draft_version_id: get_last_draft_version)
- end
-
- def get_best_annotation_comments
- Comment.where(commentable_id: get_annotations_from_draft,
- commentable_type: "Legislation::Annotation", ancestry: nil)
- .order("cached_votes_up - cached_votes_down DESC")
- end
-
private
def valid_date_ranges
diff --git a/app/models/legislation/question.rb b/app/models/legislation/question.rb
index f54fa6648..ff9e0ea94 100644
--- a/app/models/legislation/question.rb
+++ b/app/models/legislation/question.rb
@@ -44,11 +44,4 @@ class Legislation::Question < ApplicationRecord
def comments_open?
process.debate_phase.open?
end
-
- def best_comments(number)
- Comment.where(commentable_id: id)
- .where(commentable_type: "Legislation::Question")
- .order("cached_votes_up - cached_votes_down DESC")
- .take(number)
- end
end
diff --git a/app/views/legislation/processes/_debate_phase.html.erb b/app/views/legislation/processes/_debate_phase.html.erb
deleted file mode 100644
index 5c9efec04..000000000
--- a/app/views/legislation/processes/_debate_phase.html.erb
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
<%= t("legislation.summary.debates_phase") %>
-
-
-
<%= t("legislation.questions.question.total", count: @process.questions.count) %>
-
-
-
-
- <% if @process.questions.empty? %>
-
-
<%= t("legislation.processes.debate.empty_questions") %>
-
- <% else %>
- <%= render "resume_questions", process: @process %>
- <% end %>
-
-
-
-
-
diff --git a/app/views/legislation/processes/_key_dates.html.erb b/app/views/legislation/processes/_key_dates.html.erb
index 889998d8a..4e8ab85c0 100644
--- a/app/views/legislation/processes/_key_dates.html.erb
+++ b/app/views/legislation/processes/_key_dates.html.erb
@@ -52,15 +52,6 @@
<% end %>
<% end %>
-
- <% if process.result_publication.enabled? && process.end_date <= Date.current %>
- >
- <%= link_to resume_legislation_process_path(process) do %>
- <%= t("legislation.summary.title") %>
- <%= format_date(process.result_publication_date) %>
- <% end %>
-
- <% end %>
diff --git a/app/views/legislation/processes/_proposal_phase.html.erb b/app/views/legislation/processes/_proposal_phase.html.erb
deleted file mode 100644
index 59245ce2a..000000000
--- a/app/views/legislation/processes/_proposal_phase.html.erb
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
<%= t("legislation.summary.proposal_phase") %>
-
-
-
<%= t("legislation.proposals.total", count: Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).count) %>
-
-
-
-
- <% if Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).empty? %>
-
-
<%= t("legislation.processes.proposals.empty_proposals") %>
-
- <% else %>
- <%= render "resume_proposal", process: @process %>
- <% end %>
-
-
-
-
-
diff --git a/app/views/legislation/processes/_resume_proposal.html.erb b/app/views/legislation/processes/_resume_proposal.html.erb
deleted file mode 100644
index 9ebb41e12..000000000
--- a/app/views/legislation/processes/_resume_proposal.html.erb
+++ /dev/null
@@ -1,17 +0,0 @@
-<% Legislation::Proposal.where(legislation_process_id: @process)
- .where(selected: true).order("cached_votes_score desc").each do |proposal| %>
-
-
-
-
-
- <%= link_to proposal.title, legislation_process_proposal_path(proposal.legislation_process_id, proposal) %>
-
-
-
-
<%= proposal.cached_votes_total - proposal.cached_votes_down %> <%= t("legislation.summary.votes") %>
-
-
-
-
-<% end %>
diff --git a/app/views/legislation/processes/_resume_questions.html.erb b/app/views/legislation/processes/_resume_questions.html.erb
deleted file mode 100644
index 1d683a3c8..000000000
--- a/app/views/legislation/processes/_resume_questions.html.erb
+++ /dev/null
@@ -1,34 +0,0 @@
-<% @process.questions.each do |question| %>
-
-
-
-
-
-
-
<%= link_to question.title, legislation_process_question_path(question.process, question) %>
-
-
-
-
-
-
-
- <% if question.comments.count > 0 %>
-
<%= t("legislation.summary.most_voted_comments") %>
- <% end %>
-
- <% question.best_comments(3).each do |comment| %>
-
-
-
-
-
<%= comment.cached_votes_up - comment.cached_votes_down %> <%= t("legislation.summary.votes") %>
-
- <% end %>
-
-
-
-
-<% end %>
diff --git a/app/views/legislation/processes/_resume_text.html.erb b/app/views/legislation/processes/_resume_text.html.erb
deleted file mode 100644
index f61e25fea..000000000
--- a/app/views/legislation/processes/_resume_text.html.erb
+++ /dev/null
@@ -1,29 +0,0 @@
-<% @process.get_best_annotation_comments.take(10).each do |comment| %>
-
-
-
-
-
- <%= t("legislation.annotations.index.comment_about") %>
-
-
-
-
-
- "<%= Legislation::Annotation.find_by(id: comment.commentable_id).quote %>"
-
-
-
- <%= comment.cached_votes_up - comment.cached_votes_down %> <%= t("legislation.summary.votes") %>
-
-
-
<%= t("legislation.annotations.show.title") %>:
-
-
-
-
-<% end %>
diff --git a/app/views/legislation/processes/_text_comment_phase.html.erb b/app/views/legislation/processes/_text_comment_phase.html.erb
deleted file mode 100644
index 763c0798e..000000000
--- a/app/views/legislation/processes/_text_comment_phase.html.erb
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
<%= t("legislation.summary.comments_phase") %>
- <% if !@process.get_last_draft_version.nil? %>
- (<%= t("legislation.summary.version") %> <%= @process.get_last_draft_version.title %>)
- <% end %>
-
-
-
<%= t("legislation.annotations.index.comments_count", count: @process.get_best_annotation_comments.count) %>
-
-
-
-
- <% if !@process.get_last_draft_version.nil? %>
- <% if @process.get_last_draft_version.annotations.empty? %>
-
-
<%= t("legislation.summary.no_allegation") %>
-
- <% else %>
- <%= render "resume_text", process: @process %>
- <% end %>
- <% else %>
-
-
<%= t("legislation.summary.no_allegation") %>
-
- <% end %>
-
-
-
-
-
diff --git a/app/views/legislation/processes/resume.html.erb b/app/views/legislation/processes/resume.html.erb
deleted file mode 100644
index 50758ddad..000000000
--- a/app/views/legislation/processes/resume.html.erb
+++ /dev/null
@@ -1,28 +0,0 @@
-<% provide(:title) { @process.title } %>
-
-<%= render "legislation/processes/header", process: @process, header: :full %>
-
-<%= render "key_dates", process: @process, phase: @phase %>
-
-<% if !@process.debate_phase.enabled? && !@process.proposals_phase.enabled? && !@process.allegations_phase.enabled? %>
-
-
<%= t("legislation.summary.process_empty") %>
-
-<% else %>
-
-
- <% if @process.debate_phase.enabled? %>
- <%= render "debate_phase", process: @process %>
- <% end %>
-
- <% if @process.proposals_phase.enabled? %>
- <%= render "proposal_phase", process: @process %>
- <% end %>
-
- <% if @process.allegations_phase.enabled? %>
- <%= render "text_comment_phase", process: @process %>
- <% end %>
-
-<% end %>
diff --git a/app/views/legislation/processes/resume_to_xlsx.xlsx.axlsx b/app/views/legislation/processes/resume_to_xlsx.xlsx.axlsx
deleted file mode 100644
index 6dd1ebd65..000000000
--- a/app/views/legislation/processes/resume_to_xlsx.xlsx.axlsx
+++ /dev/null
@@ -1,36 +0,0 @@
-wb = xlsx_package.workbook
-space = " "
-wb.add_worksheet(name: "Resume") do |sheet|
- if @process.debate_phase.enabled? && !@process.questions.empty?
- sheet.add_row [t("legislation.summary.debates_phase"), t("legislation.questions.question.total", count: @process.questions.count)]
- @process.questions.each do |question|
- sheet.add_row [question.title, t("legislation.summary.comments", count: question.comments.count)]
- sheet.add_hyperlink location: legislation_process_question_url(question.process, question), ref: sheet.rows.last.cells.first
- question.best_comments(3).each do |comment|
- sheet.add_row [comment.body, (comment.cached_votes_up - comment.cached_votes_down).to_s + space + t("legislation.summary.votes")]
- sheet.add_hyperlink location: comment_url(comment), ref: sheet.rows.last.cells.first
- end
- sheet.add_row ["", ""]
- end
- end
-
- if @process.proposals_phase.enabled? && !Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).empty?
- sheet.add_row [t("legislation.summary.proposal_phase"), t("legislation.proposals.total", count: Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).count)]
- Legislation::Proposal.where(legislation_process_id: @process).where(selected: true).order("cached_votes_score desc").each do |proposal|
- sheet.add_row [proposal.title,
- (proposal.cached_votes_total - proposal.cached_votes_down).to_s + space + t("legislation.summary.votes")]
- sheet.add_hyperlink location: legislation_process_proposal_url(proposal.legislation_process_id, proposal), ref: sheet.rows.last.cells.first
- end
- sheet.add_row ["", ""]
- end
-
- if @process.allegations_phase.enabled? && !@process.get_last_draft_version.nil? && !@process.get_last_draft_version.annotations.empty?
- sheet.add_row [t("legislation.summary.comments_phase") + " (" + t("legislation.summary.version") + @process.get_last_draft_version.title + ")",
- t("legislation.annotations.index.comments_count", count: @process.get_best_annotation_comments.count)]
- @process.get_best_annotation_comments.take(10).each do |comment|
- sheet.add_row [Legislation::Annotation.find_by(id: comment.commentable_id).quote, ""]
- sheet.add_row [comment.body, (comment.cached_votes_up - comment.cached_votes_down).to_s + space + t("legislation.summary.votes")]
- sheet.add_hyperlink location: comment_url(comment), ref: sheet.rows.last.cells.first
- end
- end
-end
diff --git a/config/locales/en/legislation.yml b/config/locales/en/legislation.yml
index d4186dedf..943544234 100644
--- a/config/locales/en/legislation.yml
+++ b/config/locales/en/legislation.yml
@@ -17,10 +17,8 @@ en:
index:
title: Comments
comments_about: Comments about
- comment_about: "Comment about:"
see_in_context: See in context
comments_count:
- zero: No comments
one: "%{count} comment"
other: "%{count} comments"
show:
@@ -95,10 +93,6 @@ en:
form:
leave_comment: Leave your answer
question:
- total:
- zero: No debates
- one: "%{count} debate"
- other: "%{count} debates"
comments:
zero: No comments
one: "%{count} comment"
@@ -124,21 +118,3 @@ en:
tags_label: "Categories"
not_verified: "For vote proposals %{verify_account}."
process_title: Collaborative legislation process
- total:
- zero: No proposals
- one: "%{count} proposal"
- other: "%{count} proposals"
- summary:
- title: Resume
- votes: votes
- debates_phase: Debates phase
- proposal_phase: Proposal phase
- comments_phase: Text comment phase
- comments:
- zero: No comments
- one: "%{count} comment"
- other: "%{count} comments"
- most_voted_comments: "Most voted comments: "
- no_allegation: There are no text comments
- version: version
- process_empty: The process have no phases.
diff --git a/config/locales/es/legislation.yml b/config/locales/es/legislation.yml
index a825d9fe4..fe723e250 100644
--- a/config/locales/es/legislation.yml
+++ b/config/locales/es/legislation.yml
@@ -17,7 +17,6 @@ es:
index:
title: Comentarios
comments_about: Comentarios sobre
- comment_about: "Comentario sobre:"
see_in_context: Ver en contexto
comments_count:
one: "%{count} comentario"
@@ -94,10 +93,6 @@ es:
form:
leave_comment: Deja tu respuesta
question:
- total:
- zero: No hay debates
- one: "%{count} debate"
- other: "%{count} debates"
comments:
zero: Sin comentarios
one: "%{count} comentario"
@@ -123,21 +118,3 @@ es:
tags_label: "Categorías"
not_verified: "Para votar propuestas %{verify_account}."
process_title: Proceso de legislación colaborativa
- total:
- zero: No hay propuestas
- one: "%{count} propuesta"
- other: "%{count} propuestas"
- summary:
- title: Resumen
- votes: votos
- debates_phase: Fase de debates
- proposal_phase: Fase de propuestas
- comments_phase: Fase de comentarios de texto
- comments:
- zero: No hay comentarios
- one: "%{count} comentario"
- other: "%{count} comentarios"
- most_voted_comments: "Comentarios más votados:"
- no_allegation: No hay comentarios de texto.
- version: versión
- process_empty: The proces have no phases.
diff --git a/config/routes/legislation.rb b/config/routes/legislation.rb
index 9e0f2d04b..d5054e2d4 100644
--- a/config/routes/legislation.rb
+++ b/config/routes/legislation.rb
@@ -7,7 +7,6 @@ namespace :legislation do
get :result_publication
get :proposals
get :milestones
- get :resume
end
resources :questions, only: [:show] do
diff --git a/spec/features/legislation/resume_spec.rb b/spec/features/legislation/resume_spec.rb
deleted file mode 100644
index a80e8d2ce..000000000
--- a/spec/features/legislation/resume_spec.rb
+++ /dev/null
@@ -1,244 +0,0 @@
-require "rails_helper"
-
-describe "Legislation" do
- context "process resume page" do
- scenario "resume tab not show" do
- process = create(:legislation_process, :open)
- visit legislation_process_path(process)
- expect(page).not_to have_content("Resume")
- end
-
- scenario "resume tab show" do
- process = create(:legislation_process, :past)
- visit legislation_process_path(process)
- expect(page).to have_content("Resume")
- end
- end
-
- context "process empty" do
- let(:process) { create(:legislation_process, :empty, end_date: Date.current - 1.day) }
-
- scenario "warning empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("The process have no phases.")
- end
- end
-
- context "phases empty" do
- let(:process) { create(:legislation_process, end_date: Date.current - 1.day) }
-
- scenario "debates empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Debates phase")
- expect(page).to have_content("No debates")
- expect(page).to have_content("There aren't any questions")
- end
-
- scenario "proposals empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Proposal phase")
- expect(page).to have_content("No proposals")
- expect(page).to have_content("There are no proposals")
- end
-
- scenario "text comments empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Text comment phase")
- expect(page).to have_content("No comments")
- expect(page).to have_content("There are no text comments")
- end
- end
-
- context "process empty" do
- let(:process) { create(:legislation_process, :empty, end_date: Date.current - 1.day) }
-
- scenario "warning empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("The process have no phases.")
- end
- end
-
- context "only debates exist" do
- let(:process) { create(:legislation_process, end_date: Date.current - 1.day) }
-
- before do
- user = create(:user, :level_two)
-
- create(:legislation_question, process: process, title: "Question 1") do |question|
- create(:comment, user: user, commentable: question, body: "Answer 1")
- create(:comment, user: user, commentable: question, body: "Answer 2")
- end
-
- create(:legislation_question, process: process, title: "Question 2") do |question|
- create(:comment, user: user, commentable: question, body: "Answer 3")
- create(:comment, user: user, commentable: question, body: "Answer 4")
- end
- end
-
- scenario "show debates list" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Debates phase")
- expect(page).to have_content("2 debates")
-
- expect(page).to have_content("Question 1")
- expect(page).to have_content("Answer 1")
- expect(page).to have_content("Answer 2")
- expect(page).to have_content("Question 2")
- expect(page).to have_content("Answer 3")
- expect(page).to have_content("Answer 4")
-
- click_link "Question 1"
- expect(page).to have_content("Question 1")
- expect(page).to have_content("Answer 1")
- expect(page).to have_content("Answer 2")
- expect(page).not_to have_content("Answer 3")
- expect(page).not_to have_content("Answer 4")
-
- visit resume_legislation_process_path(process)
- click_link "Question 2"
- expect(page).to have_content("Question 2")
- expect(page).not_to have_content("Answer 1")
- expect(page).not_to have_content("Answer 2")
- expect(page).to have_content("Answer 3")
- expect(page).to have_content("Answer 4")
- end
-
- scenario "proposals empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Proposal phase")
- expect(page).to have_content("No proposals")
- expect(page).to have_content("There are no proposals")
- end
-
- scenario "text comments empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Text comment phase")
- expect(page).to have_content("No comments")
- expect(page).to have_content("There are no text comments")
- end
- end
-
- context "only proposals exist" do
- let(:process) { create(:legislation_process, end_date: Date.current - 1.day) }
-
- before do
- create(:legislation_proposal, legislation_process_id: process.id,
- title: "Legislation proposal 1", selected: true)
- create(:legislation_proposal, legislation_process_id: process.id,
- title: "Legislation proposal 2", selected: false)
- create(:legislation_proposal, legislation_process_id: process.id,
- title: "Legislation proposal 3", selected: true)
- create(:legislation_proposal, legislation_process_id: process.id,
- title: "Legislation proposal 4", selected: false)
- end
-
- scenario "debates empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Debates phase")
- expect(page).to have_content("No debates")
- expect(page).to have_content("There aren't any questions")
- end
-
- scenario "proposals empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Proposal phase")
- expect(page).to have_content("2 proposals")
-
- expect(page).to have_content("Legislation proposal 1")
- expect(page).not_to have_content("Legislation proposal 2")
- expect(page).to have_content("Legislation proposal 3")
- expect(page).not_to have_content("Legislation proposal 4")
-
- click_link "Legislation proposal 1"
- expect(page).to have_content("Legislation proposal 1")
-
- visit resume_legislation_process_path(process)
- click_link "Legislation proposal 3"
- expect(page).to have_content("Legislation proposal 3")
- end
-
- scenario "text comments empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Text comment phase")
- expect(page).to have_content("No comments")
- expect(page).to have_content("There are no text comments")
- end
- end
-
- context "only text comments exist" do
- let(:process) { create(:legislation_process, end_date: Date.current - 1.day) }
-
- before do
- user = create(:user, :level_two)
- draft_version_1 = create(:legislation_draft_version, process: process,
- title: "Version 1", body: "Body of the first version",
- status: "published")
- draft_version_2 = create(:legislation_draft_version, process: process,
- title: "Version 2", body: "Body of the second version and that's it all of it",
- status: "published")
- annotation0 = create(:legislation_annotation,
- draft_version: draft_version_1, text: "my annotation123",
- ranges: [{ "start" => "/p[1]", "startOffset" => 5, "end" => "/p[1]", "endOffset" => 10 }])
- annotation1 = create(:legislation_annotation,
- draft_version: draft_version_2, text: "hola",
- ranges: [{ "start" => "/p[1]", "startOffset" => 5, "end" => "/p[1]", "endOffset" => 10 }])
- annotation2 = create(:legislation_annotation,
- draft_version: draft_version_2,
- ranges: [{ "start" => "/p[1]", "startOffset" => 12, "end" => "/p[1]", "endOffset" => 19 }])
-
- create(:comment, user: user, commentable: annotation0, body: "Comment 0")
- create(:comment, user: user, commentable: annotation1, body: "Comment 1")
- create(:comment, user: user, commentable: annotation2, body: "Comment 2")
- create(:comment, user: user, commentable: annotation2, body: "Comment 3")
- end
-
- scenario "debates empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Debates phase")
- expect(page).to have_content("No debates")
- expect(page).to have_content("There aren't any questions")
- end
-
- scenario "proposals empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Proposal phase")
- expect(page).to have_content("No proposals")
- expect(page).to have_content("There are no proposals")
- end
-
- scenario "text comments empty" do
- visit resume_legislation_process_path(process)
- expect(page).to have_content("Text comment phase (version Version 2")
- expect(page).to have_content("5 comments")
- expect(page).not_to have_content("Comment 0")
- expect(page).to have_content("Comment 1")
- expect(page).to have_content("Comment 2")
- expect(page).to have_content("Comment 3")
-
- click_link "Comment 2"
- expect(page).to have_content("Comment 2")
- end
-
- # scenario "excel download" do
- # visit resume_legislation_process_path(process)
- # click_link "Download"
- # page.response_headers['Content-Type'].should eq "application/xlsx"
- # end
- end
-
- describe Legislation::ProcessesController, type: :controller do
- let(:legislation_process) { create(:legislation_process, end_date: Date.current - 1.day) }
-
- before do
- user = create(:user, :level_two)
- debate = create(:legislation_question, process: legislation_process, title: "Question 1")
- create(:comment, user: user, commentable: debate, body: "Answer 1")
- create(:comment, user: user, commentable: debate, body: "Answer 2")
- end
-
- it "download execl file test" do
- get :resume, params: { id: legislation_process, format: :xlsx }
- expect(response).to be_success
- end
- end
-end