docbrown/spec/system/search/user_searches_users_spec.rb
Ben Halpern 036d75aa6e
Admin-configurable display locale (#14620)
* Admin-configurable display locale

* Add i18n-js and namespacing

* Basic tests and clean up

* A few test adjustments

* Update vendor cache

* Fix a few tests

* Fix a few tests

* Update app/views/articles/_actions.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/articles/_comments_actions.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/articles/_single_story.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/articles/_single_story.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/comments/_comment_header.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/layouts/_sidebar_tags.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update app/views/listings/index.html.erb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/system/homepage/user_visits_homepage_articles_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Update spec/system/user/view_user_index_spec.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

* Alphabetical locale page

* Add activerecord custom validation error translations

* Add i18n to webpacker

* Fix a few tests

* Adjust error messages

* Add i18n-tasks

* Adjust JS to get working with jest

* Adjust the way translations are pulled in

* Adjust jest tests

* Remove time localization

* Remove superfluous public js

* Add basic tests for i18n application controller

* Remove unnecessary content

Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-09-28 11:04:35 -04:00

24 lines
932 B
Ruby

require "rails_helper"
RSpec.describe "User searches users", type: :system do
let(:current_user) { create(:user) }
let(:followed_user) { create(:user) }
let(:not_followed_user) { create(:user) }
let(:follow_back_user) { create(:user) }
before do
sign_in current_user
current_user.follow(followed_user)
follow_back_user.follow(current_user)
not_followed_user
end
it "shows the correct follow buttons", js: true do
visit "/search?q=&filters=class_name:User"
expect(JSON.parse(find_button(I18n.t("core.edit_profile"))["data-info"])["id"]).to eq(current_user.id)
expect(JSON.parse(find_button(I18n.t("core.following"))["data-info"])["id"]).to eq(followed_user.id)
expect(JSON.parse(find_button(I18n.t("core.follow"))["data-info"])["id"]).to eq(not_followed_user.id)
expect(JSON.parse(find_button(I18n.t("core.follow_back"))["data-info"])["id"]).to eq(follow_back_user.id)
end
end