Skip to content

Commit

Permalink
Add authentication tests for text search
Browse files Browse the repository at this point in the history
Issue #166
  • Loading branch information
reefdog committed Sep 21, 2022
1 parent 2a8995f commit 6d56a55
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/controllers/text_search_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,30 @@
class ArchiveControllerTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers

test "must be logged in to view text search" do
get text_search_url
assert_response :redirect
end

test "may view text search if logged in" do
sign_in users(:user)

get text_search_url
assert_response :success
end

test "must be logged in to perform text search" do
get text_search_submit_url query: "Biden"
assert_response :redirect
end

test "may perform text search if logged in" do
sign_in users(:user)

get text_search_submit_url query: "Biden"
assert_response :success
end

test "can run text search" do
# First we need to create a few posts.
Sources::Tweet.create_from_url("https://twitter.com/POTUS/status/1430341234472669188")
Expand Down

0 comments on commit 6d56a55

Please sign in to comment.