[deploy] Use bulk_show Endpoint for Follow Buttons on Followers Dashboard (#7849)

This commit is contained in:
Molly Struve 2020-05-14 11:25:29 -05:00 committed by GitHub
parent 5b4ef24468
commit d2fbad08d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View file

@ -31,7 +31,7 @@
<span class="dashboard-username">@<%= user.username %></span>
<a href="#"
id="dashboard-follow"
class="cta follow-action-button dashboard-follow"
class="cta follow-action-button dashboard-follow follow-user"
data-info='{"id":<%= user.id %>,"className":"<%= user.class.name %>","style":"follow-back"}'>
&nbsp;
</a>

View file

@ -0,0 +1,25 @@
require "rails_helper"
RSpec.describe "Followers Dashboard", type: :system, js: true do
let(:default_per_page) { 3 }
let(:user) { create(:user) }
let(:followed_user) { create(:user) }
let(:following_user) { create(:user) }
before do
sign_in user
end
context "when /dashboard/user_followers is visited" do
it "displays correct following buttons" do
stub_request(:post, "http://www.google-analytics.com/collect")
following_user.follow(user)
followed_user.follow(user)
user.follow(followed_user)
visit "/dashboard/user_followers"
expect(JSON.parse(find_link("✓ FOLLOWING")["data-info"])["id"]).to eq(followed_user.id)
expect(JSON.parse(find_link("+ FOLLOW BACK")["data-info"])["id"]).to eq(following_user.id)
end
end
end