Use describe on feature tests

The `type: :feature` is automatically detected by RSpec because these
tests are inside the `spec/features` folder. Using `feature` re-adds a
`type: :feature` to these files, which will result in a conflict when we
upgrade to Rails 5.1's system tests.

Because of this change, we also need to change `background` to `before`
or else these tests will fail.
This commit is contained in:
Javi Martín
2019-04-29 11:52:36 +02:00
parent 234a5108a4
commit 307cf24846
169 changed files with 416 additions and 420 deletions

View File

@@ -1,6 +1,6 @@
require "rails_helper"
feature "Legislation Draft Versions" do
describe "Legislation Draft Versions" do
let(:user) { create(:user) }
let(:administrator) do
create(:administrator, user: user)
@@ -143,7 +143,7 @@ feature "Legislation Draft Versions" do
context "Annotations", :js do
let(:user) { create(:user) }
background { login_as user }
before { login_as user }
scenario "Visit as anonymous" do
logout
@@ -222,7 +222,7 @@ feature "Legislation Draft Versions" do
let(:user) { create(:user) }
background { login_as user }
before { login_as user }
scenario "View annotations and comments in an included range" do
draft_version = create(:legislation_draft_version, :published)
@@ -246,7 +246,7 @@ feature "Legislation Draft Versions" do
end
context "Annotations page" do
background do
before do
@draft_version = create(:legislation_draft_version, :published)
create(:legislation_annotation, draft_version: @draft_version, text: "my annotation", quote: "ipsum",
ranges: [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}])
@@ -262,7 +262,7 @@ feature "Legislation Draft Versions" do
end
context "switching versions" do
background do
before do
@process = create(:legislation_process)
@draft_version_1 = create(:legislation_draft_version, :published, process: @process,
title: "Version 1", body: "Text with quote for version 1")
@@ -298,7 +298,7 @@ feature "Legislation Draft Versions" do
end
context "Annotation comments page" do
background do
before do
@draft_version = create(:legislation_draft_version, :published)
create(:legislation_annotation, draft_version: @draft_version, text: "my annotation", quote: "ipsum",
ranges: [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}])

View File

@@ -1,6 +1,6 @@
require "rails_helper"
feature "Legislation" do
describe "Legislation" do
let!(:administrator) { create(:administrator).user }

View File

@@ -1,7 +1,7 @@
require "rails_helper"
require "sessions_helper"
feature "Legislation Proposals" do
describe "Legislation Proposals" do
let(:user) { create(:user) }
let(:user2) { create(:user) }
@@ -20,7 +20,7 @@ feature "Legislation Proposals" do
end
end
feature "Random pagination" do
describe "Random pagination" do
before do
allow(Legislation::Proposal).to receive(:default_per_page).and_return(12)

View File

@@ -1,6 +1,6 @@
require "rails_helper"
feature "Legislation" do
describe "Legislation" do
context "process debate page" do
before do
@process = create(:legislation_process, debate_start_date: Date.current - 3.days, debate_end_date: Date.current + 2.days)