Compare against literal title in feature specs
We were creating records with a title we manually set, so to be consistent with the rest of the code, in the test we check the title is present using a string literal. This way we can also remove useless assignments while keeping the code vertically aligned.
This commit is contained in:
@@ -3,7 +3,7 @@ require "rails_helper"
|
||||
describe "Admin tags" do
|
||||
|
||||
before do
|
||||
@tag1 = create(:tag, :category)
|
||||
create(:tag, :category, name: "Existence")
|
||||
login_as(create(:administrator).user)
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ describe "Admin tags" do
|
||||
debate.tag_list.add(create(:tag, :category, name: "supertag"))
|
||||
visit admin_tags_path
|
||||
|
||||
expect(page).to have_content @tag1.name
|
||||
expect(page).to have_content "Existence"
|
||||
expect(page).to have_content "supertag"
|
||||
end
|
||||
|
||||
@@ -33,38 +33,39 @@ describe "Admin tags" do
|
||||
|
||||
scenario "Delete" do
|
||||
tag2 = create(:tag, :category, name: "bad tag")
|
||||
create(:debate, tag_list: tag2.name)
|
||||
create(:debate, tag_list: "bad tag")
|
||||
|
||||
visit admin_tags_path
|
||||
|
||||
expect(page).to have_content @tag1.name
|
||||
expect(page).to have_content tag2.name
|
||||
expect(page).to have_content "Existence"
|
||||
expect(page).to have_content "bad tag"
|
||||
|
||||
within("#tag_#{tag2.id}") do
|
||||
click_link "Delete topic"
|
||||
end
|
||||
|
||||
visit admin_tags_path
|
||||
expect(page).to have_content @tag1.name
|
||||
expect(page).not_to have_content tag2.name
|
||||
expect(page).to have_content "Existence"
|
||||
expect(page).not_to have_content "bad tag"
|
||||
end
|
||||
|
||||
scenario "Delete tag with hidden taggables" do
|
||||
tag2 = create(:tag, :category, name: "bad tag")
|
||||
debate = create(:debate, tag_list: tag2.name)
|
||||
debate = create(:debate, tag_list: "bad tag")
|
||||
debate.hide
|
||||
|
||||
visit admin_tags_path
|
||||
|
||||
expect(page).to have_content @tag1.name
|
||||
expect(page).to have_content tag2.name
|
||||
expect(page).to have_content "Existence"
|
||||
expect(page).to have_content "bad tag"
|
||||
|
||||
within("#tag_#{tag2.id}") do
|
||||
click_link "Delete topic"
|
||||
end
|
||||
|
||||
visit admin_tags_path
|
||||
expect(page).to have_content @tag1.name
|
||||
expect(page).not_to have_content tag2.name
|
||||
expect(page).to have_content "Existence"
|
||||
expect(page).not_to have_content "bad tag"
|
||||
end
|
||||
|
||||
context "Manage only tags of kind category" do
|
||||
@@ -73,7 +74,7 @@ describe "Admin tags" do
|
||||
|
||||
visit admin_tags_path
|
||||
|
||||
expect(page).to have_content @tag1.name
|
||||
expect(page).to have_content "Existence"
|
||||
expect(page).not_to have_content "Not a category"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user