Make relationable test expectations consistent
We're removing the parenthesis after page expectations (as we do almost everywhere) and we're replacing `have_selector` with `have_css`, since on that file we were using `have_css` everywhere except in one place.
This commit is contained in:
@@ -10,25 +10,25 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
|
||||
visit relationable.url
|
||||
within("#related-content-list") do
|
||||
expect(page).to have_content(related1.title)
|
||||
expect(page).to have_content related1.title
|
||||
end
|
||||
|
||||
visit related1.url
|
||||
within("#related-content-list") do
|
||||
expect(page).to have_content(relationable.title)
|
||||
expect(page).to have_content relationable.title
|
||||
end
|
||||
end
|
||||
|
||||
scenario "related contents list is not rendered if there are no relations" do
|
||||
visit relationable.url
|
||||
expect(page).not_to have_css("#related-content-list")
|
||||
expect(page).not_to have_css "#related-content-list"
|
||||
end
|
||||
|
||||
scenario "related contents can be added" do
|
||||
login_as(user)
|
||||
visit relationable.url
|
||||
|
||||
expect(page).not_to have_selector("#related_content")
|
||||
expect(page).not_to have_css "#related_content"
|
||||
|
||||
click_button "Add related content"
|
||||
|
||||
@@ -38,13 +38,13 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
end
|
||||
|
||||
within("#related-content-list") do
|
||||
expect(page).to have_content(related1.title)
|
||||
expect(page).to have_content related1.title
|
||||
end
|
||||
|
||||
visit related1.url
|
||||
|
||||
within("#related-content-list") do
|
||||
expect(page).to have_content(relationable.title)
|
||||
expect(page).to have_content relationable.title
|
||||
end
|
||||
|
||||
click_button "Add related content"
|
||||
@@ -55,7 +55,7 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
end
|
||||
|
||||
within("#related-content-list") do
|
||||
expect(page).to have_content(related2.title)
|
||||
expect(page).to have_content related2.title
|
||||
end
|
||||
end
|
||||
|
||||
@@ -70,7 +70,7 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
click_button "Add"
|
||||
end
|
||||
|
||||
expect(page).to have_content("Link not valid. Remember to start with #{url}.")
|
||||
expect(page).to have_content "Link not valid. Remember to start with #{url}."
|
||||
end
|
||||
|
||||
scenario "returns error when relating content URL to itself" do
|
||||
@@ -84,7 +84,7 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
click_button "Add"
|
||||
end
|
||||
|
||||
expect(page).to have_content("Link not valid. You cannot relate a content to itself")
|
||||
expect(page).to have_content "Link not valid. You cannot relate a content to itself"
|
||||
end
|
||||
|
||||
scenario "related content can be scored positively" do
|
||||
@@ -96,7 +96,7 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
within("#related-content-list") do
|
||||
find("#related-content-#{related_content.opposite_related_content.id}").hover
|
||||
find("#score-positive-related-#{related_content.opposite_related_content.id}").click
|
||||
expect(page).not_to have_css("#score-positive-related-#{related_content.opposite_related_content.id}")
|
||||
expect(page).not_to have_css "#score-positive-related-#{related_content.opposite_related_content.id}"
|
||||
end
|
||||
|
||||
expect(related_content.related_content_scores.find_by(user_id: user.id, related_content_id: related_content.id).value).to eq(1)
|
||||
@@ -112,7 +112,7 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
within("#related-content-list") do
|
||||
find("#related-content-#{related_content.opposite_related_content.id}").hover
|
||||
find("#score-negative-related-#{related_content.opposite_related_content.id}").click
|
||||
expect(page).not_to have_css("#score-negative-related-#{related_content.opposite_related_content.id}")
|
||||
expect(page).not_to have_css "#score-negative-related-#{related_content.opposite_related_content.id}"
|
||||
end
|
||||
|
||||
expect(related_content.related_content_scores.find_by(user_id: user.id, related_content_id: related_content.id).value).to eq(-1)
|
||||
@@ -134,6 +134,6 @@ shared_examples "relationable" do |relationable_model_name|
|
||||
|
||||
visit relationable.url
|
||||
|
||||
expect(page).not_to have_css("#related-content-list")
|
||||
expect(page).not_to have_css "#related-content-list"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user