Skip to content

Commit

Permalink
Add test for the dogs#index action
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinthinks committed Aug 25, 2022
1 parent 6b89e4d commit f0c222a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ group :test do
gem "selenium-webdriver", ">= 4.1.0"
gem "webdrivers", "5.0.0"
gem 'rexml', '~> 3.2.5'

# Provides extra assertions and matchers for testing controllers and views
gem 'rails-controller-testing'
end

gem 'devise'
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ GEM
activesupport (= 7.0.2.4)
bundler (>= 1.15.0)
railties (= 7.0.2.4)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
Expand Down Expand Up @@ -271,6 +275,7 @@ DEPENDENCIES
pg (~> 1.4.1)
puma (~> 5.6.4)
rails (~> 7.0.2.2)
rails-controller-testing
react-rails (~> 2.6.1)
rexml (~> 3.2.5)
rolify
Expand Down
14 changes: 14 additions & 0 deletions test/controllers/dogs_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require "test_helper"

class DogsControllerTest < ActionController::TestCase

test "should get index with proper content" do
get :index

assert_response :success
assert_not_nil assigns(:dogs)
assert_includes @response.body, "Fosterable Dogs"
assert_includes @response.body, "Thinking about fostering? These adorable dogs from local rescues need someone to foster them while they await their furever home. Click on a dog below to see more information about each dog."
end

end

0 comments on commit f0c222a

Please sign in to comment.