Skip to content

Commit

Permalink
move test to request spec
Browse files Browse the repository at this point in the history
  • Loading branch information
cdoyle-temple committed Sep 23, 2024
1 parent b707b35 commit d15cbf0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/views/webpages/search.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="container px-0 px-lg-3 index" id="search-results">
<div class="container px-0 px-lg-3 index">
<div class="row">
<div class="col">
<h1 class="my-4">You searched for: <small><%= params[:q] %></small></h1>
Expand All @@ -7,7 +7,7 @@
<% if @results.present? %>
<div class="row">
<% if @books.present? %>
<div class="col-12 col-lg-7">
<div class="col-12 col-lg-7" id="search-results">

<h2 class="gold mt-3 mx-1 d-none d-lg-block">Book Results</h2>
<%= button_tag("",
Expand Down
4 changes: 0 additions & 4 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
config.include Devise::Test::ControllerHelpers, type: :helper
config.include Devise::Test::ControllerHelpers, type: :view

config.before(:each, type: :system, js: true) do
driven_by :selenium_chrome_headless
end

# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = Rails.root.join("spec/fixtures")

Expand Down
20 changes: 20 additions & 0 deletions spec/requests/search_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

require "rails_helper"

RSpec.describe "Webpage", type: :request do

describe "search" do
before(:all) do
@series = FactoryBot.create(:series, title: "Stewart Loses Out", unpublish: true)
end

scenario "for published series" do
get("/search?q=#{@series.title}")
within "#search-results" do
expect(response.body).to_not match(@series.title)
end
end
end

end

0 comments on commit d15cbf0

Please sign in to comment.