Fix abilities and add specs
This commit is contained in:
@@ -12,7 +12,7 @@ module Abilities
|
||||
can [:search, :read], Annotation
|
||||
can :new, DirectMessage
|
||||
can [:read, :draft_publication, :allegations, :final_version_publication], Legislation::Process
|
||||
can [:read], Legislation::DraftVersion
|
||||
can [:read, :changes, :go_to_version], Legislation::DraftVersion
|
||||
can [:read], Legislation::Question
|
||||
can [:create], Legislation::Answer
|
||||
end
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
<div class="small-12 calc-index column border-right js-toggle-allegations">
|
||||
<div class="draft-panel">
|
||||
<div>
|
||||
<span class="icon-banner" aria-hidden="true"></span> <span class="panel-title"><%= t('.text_index') %></span>
|
||||
<span class="icon-banner" aria-hidden="true"></span> <span class="panel-title"><%= t('.text_toc') %></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="draft-index-rotated center">
|
||||
<span class="panel-title"><%= t('.text_index') %></span>
|
||||
<span class="panel-title"><%= t('.text_toc') %></span>
|
||||
</div>
|
||||
|
||||
<div class="draft-index">
|
||||
|
||||
@@ -235,7 +235,7 @@ en:
|
||||
updated_at: updated at %{date}
|
||||
see_changes: see changes summary
|
||||
see_comments: See all comments
|
||||
text_index: Index
|
||||
text_toc: Table of contents
|
||||
text_body: Text
|
||||
text_comments: Comments
|
||||
processes:
|
||||
|
||||
@@ -235,7 +235,7 @@ es:
|
||||
updated_at: actualizada el %{date}
|
||||
see_changes: ver resumen de cambios
|
||||
see_comments: Ver todos los comentarios
|
||||
text_index: Índice
|
||||
text_toc: Índice
|
||||
text_body: Texto
|
||||
text_comments: Comentarios
|
||||
processes:
|
||||
|
||||
75
spec/features/legislation/draft_versions_spec.rb
Normal file
75
spec/features/legislation/draft_versions_spec.rb
Normal file
@@ -0,0 +1,75 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Legislation Draft Versions' do
|
||||
|
||||
context "See draft text page" do
|
||||
before(:each) do
|
||||
@process = create(:legislation_process)
|
||||
@draft_version_1 = create(:legislation_draft_version, process: @process, title: "Version 1", body: "Body of the first version")
|
||||
@draft_version_2 = create(:legislation_draft_version, process: @process, title: "Version 2", body: "Body of the second version")
|
||||
end
|
||||
|
||||
it "shows the text body for this version" do
|
||||
visit legislation_process_draft_version_path(@process, @draft_version_1)
|
||||
|
||||
expect(page).to have_content("Body of the first version")
|
||||
end
|
||||
|
||||
it "switches to another version without js" do
|
||||
visit legislation_process_draft_version_path(@process, @draft_version_1)
|
||||
expect(page).to have_content("Body of the first version")
|
||||
|
||||
select("Version 2")
|
||||
click_button "see"
|
||||
|
||||
expect(page).to_not have_content("Body of the first version")
|
||||
expect(page).to have_content("Body of the second version")
|
||||
end
|
||||
|
||||
it "switches to another version with js", :js do
|
||||
visit legislation_process_draft_version_path(@process, @draft_version_1)
|
||||
expect(page).to have_content("Body of the first version")
|
||||
|
||||
select("Version 2")
|
||||
|
||||
expect(page).to_not have_content("Body of the first version")
|
||||
expect(page).to have_content("Body of the second version")
|
||||
end
|
||||
end
|
||||
|
||||
context "See changes page" do
|
||||
before(:each) do
|
||||
@process = create(:legislation_process)
|
||||
@draft_version_1 = create(:legislation_draft_version, process: @process, title: "Version 1", body: "Body of the first version", changelog: "Changes for first version")
|
||||
@draft_version_2 = create(:legislation_draft_version, process: @process, title: "Version 2", body: "Body of the second version", changelog: "Changes for second version")
|
||||
end
|
||||
|
||||
it "shows the text body for this version" do
|
||||
visit legislation_process_draft_version_changes_path(@process, @draft_version_1)
|
||||
|
||||
expect(page).to have_content("Changes for first version")
|
||||
end
|
||||
|
||||
it "switches to another version without js" do
|
||||
visit legislation_process_draft_version_changes_path(@process, @draft_version_1)
|
||||
expect(page).to have_content("Changes for first version")
|
||||
|
||||
select("Version 2")
|
||||
click_button "see"
|
||||
|
||||
expect(page).to_not have_content("Changes for first version")
|
||||
expect(page).to have_content("Changes for second version")
|
||||
end
|
||||
|
||||
it "switches to another version with js", :js do
|
||||
visit legislation_process_draft_version_changes_path(@process, @draft_version_1)
|
||||
expect(page).to have_content("Changes for first version")
|
||||
|
||||
select("Version 2")
|
||||
|
||||
expect(page).to_not have_content("Changes for first version")
|
||||
expect(page).to have_content("Changes for second version")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user