Use activerecord model name on followable specs

This commit is contained in:
Bertocq
2017-12-13 14:11:22 +01:00
parent 377a1d9f01
commit 1c863d7d84

View File

@@ -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")
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
end
end
@@ -37,8 +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")
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
end
scenario "Should display unfollow after user clicks on follow button", :js do
@@ -47,7 +46,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link "Follow"
click_link("Follow #{followable.model_name.human.downcase}")
expect(page).not_to have_link "Follow"
expect(page).to have_link "Unfollow"
@@ -60,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"
click_link("Follow #{followable.model_name.human.downcase}")
end
expect(page).to have_content strip_tags(t("shared.followable.#{followable_class_name}.create.notice_html"))
@@ -83,10 +82,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link "Unfollow"
click_link("Unfollow #{followable.model_name.human.downcase}")
expect(page).not_to have_link "Unfollow"
expect(page).to have_link "Follow"
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
end
end
@@ -97,7 +96,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
visit send(followable_path, arguments)
within "##{dom_id(followable)}" do
click_link "Unfollow"
click_link("Unfollow #{followable.model_name.human.downcase}")
end
expect(page).to have_content strip_tags(t("shared.followable.#{followable_class_name}.destroy.notice_html"))