Replace link with buttons in follow button

This commit is contained in:
cyrillefr
2025-04-14 10:40:25 +02:00
parent ddfd1bedb3
commit e370a52650
2 changed files with 23 additions and 23 deletions

View File

@@ -17,7 +17,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
expect(page).not_to have_link("Follow")
expect(page).not_to have_button("Follow")
end
end
@@ -28,7 +28,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
end
end
@@ -37,7 +37,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
login_as(user)
visit send(followable_path, arguments)
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
end
scenario "Should display unfollow after user clicks on follow button" do
@@ -46,10 +46,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link("Follow #{followable.model_name.human.downcase}")
click_button("Follow #{followable.model_name.human.downcase}")
expect(page).not_to have_link("Follow")
expect(page).to have_link("Following")
expect(page).not_to have_button("Follow")
expect(page).to have_button("Following")
end
end
@@ -59,7 +59,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link("Follow #{followable.model_name.human.downcase}")
click_button("Follow #{followable.model_name.human.downcase}")
end
expect(page).to have_content "We will notify you of changes as they occur"
@@ -71,7 +71,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
expect(page).to have_link("Following")
expect(page).to have_button("Following")
end
scenario "Updates follow button & show destroy notice after unfollow button is clicked" do
@@ -80,10 +80,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link("Unfollow #{followable.model_name.human.downcase}")
click_button("Unfollow #{followable.model_name.human.downcase}")
expect(page).not_to have_link("Unfollow")
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
expect(page).not_to have_button("Unfollow")
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
end
end
@@ -93,7 +93,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link("Unfollow #{followable.model_name.human.downcase}")
click_button("Unfollow #{followable.model_name.human.downcase}")
end
expect(page).to have_content "You will no longer receive notifications"