* feed cards * frontend * preactify * preactify * . * fix * fixing things and adding dropdown * whoops. * whoops 2. * revert body bg color change * search snippet * search snippet * get rid of featured article * get rid of featured article... * cover to its own component * videos * videos * reading time * small-save-filled asset * author adjustments * adjustments * Author --> Meta * whoops. * loader * logged out state * . * dropping what's not needed for now * better name for cover * get rid of nav overflow * bringin comments placeholder back * bringing comments placeholder back * publish date * fix * date * . * save button icon * ghost button * lets skip the icon for saving for now * more buttons * counting logic * Display top comments on homepage feed * Comment list and item components * Remove 'Top Comments' title * Remove subscribe button, add reading time * Update snapshots and tests * Fix article and follower scrolling * Added reading time * (Try) to do flare tags * Button component from Pawel * More button styles from Pawel * Comment count style from Pawel * Handle empty parens for age on older articles * Dont show 'more comment' button for more than 2 comments * cover ratio * flare tag * cover fix * fix buttons * more button fixes * tags fix * responsiveness fix * reading time + a bit of responsiveness * Reading time in more places * snapshots * default color for flare tag * Update CommentsList test snapshot with new styles * fixing search results * fixing buttons * Fix podcast card tests by updating snapshots * Line clamping for top comments * Reflect save button state after click before mouseout * Now the entire feed card is clickable. (#7638) * Now pointer cursor is only on feed posts. (#7727) * Revert podcast card styling * Update test snapshot * merge * Fix rspec on feed page * Reduce complexity of class check for feed card clicking * PR feedback/fixes * Fix featured article test and snapshot * Last minute test tweaks * clean up crayons * padding issue + empty div * Correct merge error * Fix search results tests * Test fixes and snapshot updates * themes * podcasts colors Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com> Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
41 lines
1.9 KiB
Ruby
41 lines
1.9 KiB
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "Display articles search spec", type: :system, js: true, elasticsearch: "FeedContent" do
|
|
let(:found_article_one) { create(:article) }
|
|
let(:found_article_two) { create(:article) }
|
|
let(:not_found_article) { create(:article) }
|
|
|
|
before do
|
|
stub_request(:post, "http://www.google-analytics.com/collect")
|
|
end
|
|
|
|
it "returns correct results for a search" do
|
|
found_article_one.tags << create(:tag, name: "ruby")
|
|
allow(found_article_two).to receive(:body_text).and_return("Ruby Tuesday")
|
|
allow(not_found_article).to receive(:body_text).and_return("Python All Day Long")
|
|
articles = [found_article_one, found_article_two, not_found_article]
|
|
index_documents_for_search_class(articles, Search::FeedContent)
|
|
visit "/search?q=ruby&filters=class_name:Article"
|
|
|
|
expect(page).to have_content(found_article_one.title)
|
|
expect(page).to have_content(found_article_two.title)
|
|
expect(page).not_to have_content(not_found_article.title)
|
|
end
|
|
|
|
it "returns all expected article fields" do
|
|
allow(found_article_one).to receive(:reading_time).and_return(5)
|
|
allow(found_article_one).to receive(:comments_count).and_return(2)
|
|
found_article_one.tags << create(:tag, name: "ruby")
|
|
index_documents_for_search_class([found_article_one], Search::FeedContent)
|
|
visit "/search?q=ruby&filters=class_name:Article"
|
|
|
|
expect(page).to have_content(found_article_one.title)
|
|
expect(find("#article-link-#{found_article_one.id}")["href"]).to include(found_article_one.path)
|
|
expect(page).to have_selector("button[data-reactable-id=\"#{found_article_one.id}\"]")
|
|
expect(page).to have_content("5 min read")
|
|
expect(find_link("#ruby")["href"]).to include("/t/ruby")
|
|
expect(find_link(found_article_one.user.name)["href"]).to include(found_article_one.username)
|
|
expect(page).to have_content("0 reactions")
|
|
expect(page).to have_content("2 comments")
|
|
end
|
|
end
|