* Rubocop fixes in spec/requests * Fixed spec/requests/api/v0/articles_spec.rb Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com> Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
24 lines
657 B
Ruby
24 lines
657 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "Stories::ArticlesSearchController" do
|
|
describe "GET query page" do
|
|
it "renders page with proper header" do
|
|
get "/search?q=hello"
|
|
expect(response.body).to include(CGI.escapeHTML("=> Search Results"))
|
|
end
|
|
|
|
context "with non-empty query" do
|
|
it "renders search term in page title" do
|
|
get "/search?q=hello"
|
|
expect(response.body).to include("Search results for hello")
|
|
end
|
|
end
|
|
|
|
context "with empty query" do
|
|
it "renders default page title" do
|
|
get "/search?q="
|
|
expect(response.body).to include("Search results")
|
|
end
|
|
end
|
|
end
|
|
end
|