Skip to content

Commit

Permalink
Add basic smoke tests to verify cms content is being rendered
Browse files Browse the repository at this point in the history
  • Loading branch information
murny committed May 6, 2024
1 parent c46801c commit 4ba7296
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 6 deletions.
52 changes: 47 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,54 @@
tmp/
.DS_Store
log/development.log
config/initializers/comfortable_mexican_sofa.rb
storage/
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore all environment files (except templates).
/.env*
!/.env*.erb

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore storage (uploaded files in development and any SQLite databases).
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

/public/assets

# Ignore master key for decrypting credentials and more.
/config/master.key

/app/assets/builds/*
!/app/assets/builds/.keep

# Ignore for Build
/vendor/bundle

# Webpacker stuff
/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity

# Our custom ignores
.DS_Store
# This is ignored due to Ansible I assume:
config/initializers/comfortable_mexican_sofa.rb
1 change: 0 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
match '/500', to: 'errors#internal_server_error', via: :all
# Ensure that this route is defined last
comfy_route :cms, path: "/"
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
27 changes: 27 additions & 0 deletions test/integration/cms_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require "test_helper"

class CmsTest < ActionDispatch::IntegrationTest
test "homepage" do
get comfy_cms_render_page_path(cms_path: "")

assert_response :success
assert_select "h2", "Search the Library"
end

test "hours and locations page" do
get comfy_cms_render_page_path(cms_path: 'hours-locations')

assert_response :success
assert_select "h1", /Hours & Locations/
end

test "about us page" do
get comfy_cms_render_page_path(cms_path: 'about-us')

assert_response :success
assert_select "h1", /About Us/
assert_select "h2", "A Message from our Chief Librarian"
end
end
8 changes: 8 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
require_relative '../config/environment'
require 'rails/test_help'

# Seed the database with our CMS seed data, if it's not already there
if Rake::Task.tasks.empty? && Comfy::Cms::Site.count.zero?
HomeCms::Application.load_tasks

Comfy::Cms::Site.create!(identifier: 'ualberta-libraries', hostname: 'localhost')
Rake::Task['comfy:cms_seeds:import'].invoke('library-cms-seeds', 'ualberta-libraries')
end

class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
Expand Down

0 comments on commit 4ba7296

Please sign in to comment.