diff --git a/playbook-website/.rspec b/playbook-website/.rspec new file mode 100644 index 0000000000..c99d2e7396 --- /dev/null +++ b/playbook-website/.rspec @@ -0,0 +1 @@ +--require spec_helper diff --git a/playbook-website/Gemfile b/playbook-website/Gemfile index e7270606bd..e74c01ade0 100644 --- a/playbook-website/Gemfile +++ b/playbook-website/Gemfile @@ -29,6 +29,9 @@ gem "sentry-rails" group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem "byebug", platforms: %i[mri mingw x64_mingw] + gem "rspec-rails", '3.9.1' + gem "diff-lcs", "1.4.4" + gem "rails-controller-testing" end group :development do @@ -42,10 +45,7 @@ end group :test do # Adds support for Capybara system testing and selenium driver - gem "capybara", ">= 2.15" - gem "selenium-webdriver" # Easy installation and use of chromedriver to run system tests with Chrome - gem "chromedriver-helper" end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem diff --git a/playbook-website/Gemfile.lock b/playbook-website/Gemfile.lock index 5547381923..61a0c7be03 100644 --- a/playbook-website/Gemfile.lock +++ b/playbook-website/Gemfile.lock @@ -12,75 +12,71 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) + actioncable (7.0.8.4) + actionpack (= 7.0.8.4) + activesupport (= 7.0.8.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + actionmailbox (7.0.8.4) + actionpack (= 7.0.8.4) + activejob (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.8.1) - actionpack (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activesupport (= 7.0.8.1) + actionmailer (7.0.8.4) + actionpack (= 7.0.8.4) + actionview (= 7.0.8.4) + activejob (= 7.0.8.4) + activesupport (= 7.0.8.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.8.1) - actionview (= 7.0.8.1) - activesupport (= 7.0.8.1) + actionpack (7.0.8.4) + actionview (= 7.0.8.4) + activesupport (= 7.0.8.4) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.8.1) - actionpack (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + actiontext (7.0.8.4) + actionpack (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8.1) - activesupport (= 7.0.8.1) + actionview (7.0.8.4) + activesupport (= 7.0.8.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8.1) - activesupport (= 7.0.8.1) + activejob (7.0.8.4) + activesupport (= 7.0.8.4) globalid (>= 0.3.6) - activemodel (7.0.8.1) - activesupport (= 7.0.8.1) - activerecord (7.0.8.1) - activemodel (= 7.0.8.1) - activesupport (= 7.0.8.1) - activestorage (7.0.8.1) - actionpack (= 7.0.8.1) - activejob (= 7.0.8.1) - activerecord (= 7.0.8.1) - activesupport (= 7.0.8.1) + activemodel (7.0.8.4) + activesupport (= 7.0.8.4) + activerecord (7.0.8.4) + activemodel (= 7.0.8.4) + activesupport (= 7.0.8.4) + activestorage (7.0.8.4) + actionpack (= 7.0.8.4) + activejob (= 7.0.8.4) + activerecord (= 7.0.8.4) + activesupport (= 7.0.8.4) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.8.1) + activesupport (7.0.8.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.2) - public_suffix (>= 2.0.2, < 6.0) - archive-zip (0.12.0) - io-like (~> 0.3.0) ast (2.4.2) babel-source (5.8.35) babel-transpiler (0.7.0) @@ -90,45 +86,43 @@ GEM erubi (>= 1.0.0) rack (>= 0.9.0) rouge (>= 1.0.0) + bigdecimal (3.1.8) bindex (0.8.1) - binding_of_caller (1.0.0) - debug_inspector (>= 0.0.1) - bootsnap (1.16.0) + binding_of_caller (1.0.1) + debug_inspector (>= 1.2.0) + bootsnap (1.18.4) msgpack (~> 1.2) - builder (3.2.4) + builder (3.3.0) byebug (11.1.3) - capybara (3.39.0) - addressable - matrix - mini_mime (>= 0.1.3) - nokogiri (~> 1.8) - rack (>= 1.6.0) - rack-test (>= 0.6.3) - regexp_parser (>= 1.5, < 3.0) - xpath (~> 3.2) - chromedriver-helper (2.1.1) - archive-zip (~> 0.10) - nokogiri (~> 1.8) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) date (3.3.4) - debug_inspector (1.1.0) - dry-cli (1.0.0) - erubi (1.12.0) + debug_inspector (1.2.0) + diff-lcs (1.4.4) + dry-cli (1.1.0) + erubi (1.13.0) execjs (2.9.1) - faker (3.2.0) + faker (3.4.2) i18n (>= 1.8.11, < 2) - ffi (1.16.3) + ffi (1.17.0-aarch64-linux-gnu) + ffi (1.17.0-aarch64-linux-musl) + ffi (1.17.0-arm-linux-gnu) + ffi (1.17.0-arm-linux-musl) + ffi (1.17.0-arm64-darwin) + ffi (1.17.0-x86-linux-gnu) + ffi (1.17.0-x86-linux-musl) + ffi (1.17.0-x86_64-darwin) + ffi (1.17.0-x86_64-linux-gnu) + ffi (1.17.0-x86_64-linux-musl) front_matter_parser (1.0.1) globalid (1.2.1) activesupport (>= 6.1) health_check (3.1.0) railties (>= 5.0) - i18n (1.14.4) + i18n (1.14.5) concurrent-ruby (~> 1.0) - io-like (0.3.1) - json (2.7.1) + json (2.7.2) language_server-protocol (3.17.0.3) listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) @@ -142,55 +136,63 @@ GEM net-pop net-smtp marcel (1.0.4) - matrix (0.4.2) - method_source (1.0.0) + method_source (1.1.0) mini_mime (1.1.5) - minitest (5.22.3) - msgpack (1.5.2) - net-imap (0.4.10) + minitest (5.25.1) + msgpack (1.7.2) + net-imap (0.4.15) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol - nio4r (2.7.1) - nokogiri (1.16.3-arm64-darwin) + nio4r (2.7.3) + nokogiri (1.16.7-aarch64-linux) + racc (~> 1.4) + nokogiri (1.16.7-arm-linux) + racc (~> 1.4) + nokogiri (1.16.7-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.3-x86_64-darwin) + nokogiri (1.16.7-x86-linux) racc (~> 1.4) - nokogiri (1.16.3-x86_64-linux) + nokogiri (1.16.7-x86_64-darwin) racc (~> 1.4) - parallel (1.24.0) - parser (3.3.0.5) + nokogiri (1.16.7-x86_64-linux) + racc (~> 1.4) + parallel (1.26.3) + parser (3.3.4.2) ast (~> 2.4.1) racc psych (3.3.4) - public_suffix (4.0.7) - puma (6.3.1) + puma (6.4.2) nio4r (~> 2.0) - racc (1.7.3) + racc (1.8.1) rack (2.2.9) rack-proxy (0.7.7) rack rack-test (2.1.0) rack (>= 1.3) - rails (7.0.8.1) - actioncable (= 7.0.8.1) - actionmailbox (= 7.0.8.1) - actionmailer (= 7.0.8.1) - actionpack (= 7.0.8.1) - actiontext (= 7.0.8.1) - actionview (= 7.0.8.1) - activejob (= 7.0.8.1) - activemodel (= 7.0.8.1) - activerecord (= 7.0.8.1) - activestorage (= 7.0.8.1) - activesupport (= 7.0.8.1) + rails (7.0.8.4) + actioncable (= 7.0.8.4) + actionmailbox (= 7.0.8.4) + actionmailer (= 7.0.8.4) + actionpack (= 7.0.8.4) + actiontext (= 7.0.8.4) + actionview (= 7.0.8.4) + activejob (= 7.0.8.4) + activemodel (= 7.0.8.4) + activerecord (= 7.0.8.4) + activestorage (= 7.0.8.4) + activesupport (= 7.0.8.4) bundler (>= 1.15.0) - railties (= 7.0.8.1) + railties (= 7.0.8.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.2.0) activesupport (>= 5.0.0) minitest @@ -198,17 +200,17 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.8.1) - actionpack (= 7.0.8.1) - activesupport (= 7.0.8.1) + railties (7.0.8.4) + actionpack (= 7.0.8.4) + activesupport (= 7.0.8.4) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) - rake (13.1.0) + rake (13.2.1) rb-fsevent (0.11.2) - rb-inotify (0.10.1) + rb-inotify (0.11.1) ffi (~> 1.0) react-rails (2.6.1) babel-transpiler (>= 0.7.0) @@ -217,39 +219,54 @@ GEM railties (>= 3.2) tilt redcarpet (3.6.0) - regexp_parser (2.9.0) - rexml (3.2.6) + regexp_parser (2.9.2) + rexml (3.3.6) + strscan rouge (3.30.0) - rubocop (1.62.1) + rspec-core (3.9.3) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.4) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.9.0) + rspec-mocks (3.9.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.9.0) + rspec-rails (3.9.1) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-support (~> 3.9.0) + rspec-support (3.9.4) + rubocop (1.65.1) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) + regexp_parser (>= 2.4, < 3.0) rexml (>= 3.2.5, < 4.0) rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.2) - parser (>= 3.3.0.4) - rubocop-performance (1.20.2) + rubocop-ast (1.32.1) + parser (>= 3.3.1.0) + rubocop-performance (1.21.1) rubocop (>= 1.48.1, < 2.0) - rubocop-ast (>= 1.30.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) ruby-progressbar (1.13.0) - rubyzip (2.3.2) - selenium-webdriver (4.8.6) - rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2, < 3.0) - websocket (~> 1.0) semantic_range (3.0.0) - sentry-rails (5.11.0) + sentry-rails (5.19.0) railties (>= 5.0) - sentry-ruby (~> 5.11.0) - sentry-ruby (5.11.0) + sentry-ruby (~> 5.19.0) + sentry-ruby (5.19.0) + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) - thor (1.3.1) - tilt (2.3.0) + strscan (3.1.0) + thor (1.3.2) + tilt (2.4.0) timeout (0.4.1) turbo-rails (1.4.0) actionpack (>= 6.0.0) @@ -257,7 +274,7 @@ GEM railties (>= 6.0.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - tzinfo-data (1.2022.1) + tzinfo-data (1.2024.1) tzinfo (>= 1.0.0) unicode-display_width (2.5.0) view_component (2.83.0) @@ -267,7 +284,7 @@ GEM vite_rails (3.0.17) railties (>= 5.1, < 8) vite_ruby (~> 3.0, >= 3.2.2) - vite_ruby (3.5.0) + vite_ruby (3.8.0) dry-cli (>= 0.7, < 2) rack-proxy (~> 0.6, >= 0.6.1) zeitwerk (~> 2.2) @@ -283,32 +300,34 @@ GEM semantic_range (>= 2.3.0) webpacker-react (0.3.2) webpacker - websocket (1.2.9) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - will_paginate (3.3.1) - xpath (3.2.0) - nokogiri (~> 1.8) - zeitwerk (2.6.13) + will_paginate (4.0.1) + zeitwerk (2.6.17) PLATFORMS - arm64-darwin-21 - arm64-darwin-22 - arm64-darwin-23 - x86_64-darwin-20 - x86_64-darwin-21 - x86_64-darwin-22 - x86_64-darwin-23 + aarch64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm-linux + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86-linux + x86-linux-gnu + x86-linux-musl + x86_64-darwin x86_64-linux + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES better_errors binding_of_caller bootsnap (>= 1.1.0) byebug - capybara (>= 2.15) - chromedriver-helper + diff-lcs (= 1.4.4) faker front_matter_parser (~> 1.0.1) health_check @@ -317,11 +336,12 @@ DEPENDENCIES psych (< 4) puma (~> 6.3) rails (~> 7.0.8) + rails-controller-testing redcarpet (~> 3.6) rouge (~> 3.15) + rspec-rails (= 3.9.1) rubocop rubocop-performance - selenium-webdriver sentry-rails sentry-ruby turbo-rails (~> 1.4.0) @@ -334,4 +354,4 @@ RUBY VERSION ruby 3.3.0p0 BUNDLED WITH - 2.5.3 + 2.5.9 diff --git a/playbook-website/app/controllers/pages_controller.rb b/playbook-website/app/controllers/pages_controller.rb index 5ee8fa95a5..c5e34a3d8b 100755 --- a/playbook-website/app/controllers/pages_controller.rb +++ b/playbook-website/app/controllers/pages_controller.rb @@ -3,9 +3,11 @@ require "will_paginate" require "playbook/pagination_renderer" require "will_paginate/array" +require "ostruct" class PagesController < ApplicationController include ::ViteRails::TagHelpers + rescue_from ActionView::MissingTemplate, :with => :page_not_found before_action :set_js, only: %i[visual_guidelines] before_action :set_kit, only: %i[kit_show_rails kit_show_react kit_show_swift] @@ -370,4 +372,8 @@ def advanced_table_mock_data advanced_table_mock_data = File.read(Rails.root.join("app/components/playbook/pb_docs/advanced_table_mock_data.json")) JSON.parse(advanced_table_mock_data, object_class: OpenStruct) end + + def page_not_found + redirect_to root_path, flash: { error: "The kit (#{params[:name]}) was not found." } + end end diff --git a/playbook-website/spec/controllers/pages_controller_spec.rb b/playbook-website/spec/controllers/pages_controller_spec.rb new file mode 100644 index 0000000000..78b8d24e6f --- /dev/null +++ b/playbook-website/spec/controllers/pages_controller_spec.rb @@ -0,0 +1,112 @@ +# frozen_string_literal: true + +# spec/controllers/pages_controller_spec.rb +require "rails_helper" + +RSpec.describe PagesController, type: :controller do + describe "GET #application_beta" do + it "responds successfully" do + get :application_beta + expect(response).to be_successful + end + + it "assigns variables" do + get :application_beta + expect(assigns(:kits)).to be_present + expect(assigns(:dark)).to be_in([true, false]) + expect(assigns(:type)).to eq("react") + expect(assigns(:examples)).to be_an(Array) + end + + it "renders the correct template" do + get :application_beta + expect(response).to render_template("application_beta") + end + end + + describe "GET #home" do + it "responds successfully" do + get :home + expect(response).to be_successful + end + + it "assigns structured data" do + get :home + expect(assigns(:structured_data)).to be_present + end + end + + describe "GET #changelog_web" do + it "responds successfully" do + get :changelog_web + expect(response).to be_successful + end + + it "renders the correct layout" do + get :changelog_web + expect(response).to render_template("layouts/changelog") + end + end + + describe "GET #kits" do + it "responds successfully" do + get :kits + expect(response).to be_successful + end + + it "assigns variables" do + get :kits + expect(assigns(:type)).to eq("react") + expect(assigns(:users)).to be_present + expect(assigns(:table_data)).to be_present + end + end + + describe "GET #kit_show_rails" do + it "responds successfully for valid kit" do + allow(controller).to receive(:missing_rails_kit?).and_return(false) + get :kit_show_rails, params: { name: "dialog" } + expect(response).to be_successful + end + + it "redirects for invalid kit" do + allow(controller).to receive(:missing_rails_kit?).and_return(true) + allow(controller).to receive(:missing_react_kit?).and_return(false) + get :kit_show_rails, params: { name: "invalid_kit" } + expect(response).to redirect_to(action: "home") + end + end + + describe "POST #enable_dark_mode" do + it "sets dark mode cookie" do + post :enable_dark_mode + expect(cookies[:dark_mode]).to eq("true") + end + + it "redirects back" do + request.env["HTTP_REFERER"] = "http://test.host/" + post :enable_dark_mode + expect(response).to redirect_to("http://test.host/") + end + end + + describe "POST #disable_dark_mode" do + it "sets dark mode cookie to false" do + post :disable_dark_mode + expect(cookies[:dark_mode]).to eq("false") + end + + it "redirects back" do + request.env["HTTP_REFERER"] = "http://test.host/" + post :disable_dark_mode + expect(response).to redirect_to("http://test.host/") + end + end + + describe "GET #kit_collection_show" do + it "should redirect to home on missing template" do + get :kit_collection_show_rails, params: { names: "image&caption§ion_separator", name: "image", variants: "1952df896c6a79bb730cdfb69adf4fa0", formats: "png" } + expect(response).to be_successful + end + end +end diff --git a/playbook-website/spec/rails_helper.rb b/playbook-website/spec/rails_helper.rb new file mode 100644 index 0000000000..ffaf940d0d --- /dev/null +++ b/playbook-website/spec/rails_helper.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# This file is copied to spec/ when you run 'rails generate rspec:install' +require "spec_helper" +ENV["RAILS_ENV"] ||= "test" + +require File.expand_path("../config/environment", __dir__) + +# Prevent database truncation if the environment is production +abort("The Rails environment is running in production mode!") if Rails.env.production? +require "rspec/rails" +# Add additional requires below this line. Rails is not loaded until this point! + +# Requires supporting ruby files with custom matchers and macros, etc, in +# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are +# run as spec files by default. This means that files in spec/support that end +# in _spec.rb will both be required and run as specs, causing the specs to be +# run twice. It is recommended that you do not name files matching this glob to +# end with _spec.rb. You can configure this pattern with the --pattern +# option on the command line or in ~/.rspec, .rspec or `.rspec-local`. +# +# The following line is provided for convenience purposes. It has the downside +# of increasing the boot-up time by auto-requiring all files in the support +# directory. Alternatively, in the individual `*_spec.rb` files, manually +# require only the support files necessary. +# +# Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each { |f| require f } + +RSpec.configure do |config| + # RSpec Rails can automatically mix in different behaviours to your tests + # based on their file location, for example enabling you to call `get` and + # `post` in specs under `spec/controllers`. + # + # You can disable this behaviour by removing the line below, and instead + # explicitly tag your specs with their type, e.g.: + # + # RSpec.describe UsersController, :type => :controller do + # # ... + # end + # + # The different available types are documented in the features, such as in + # https://relishapp.com/rspec/rspec-rails/docs + config.infer_spec_type_from_file_location! + + # Filter lines from Rails gems in backtraces. + config.filter_rails_from_backtrace! + # arbitrary gems may also be filtered via: + # config.filter_gems_from_backtrace("gem name") + + config.render_views +end diff --git a/playbook-website/spec/spec_helper.rb b/playbook-website/spec/spec_helper.rb new file mode 100644 index 0000000000..01f7c97442 --- /dev/null +++ b/playbook-website/spec/spec_helper.rb @@ -0,0 +1,96 @@ +# frozen_string_literal: true + +# This file was generated by the `rails generate rspec:install` command. Conventionally, all +# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. +# The generated `.rspec` file contains `--require spec_helper` which will cause +# this file to always be loaded, without a need to explicitly require it in any +# files. +# +# Given that it is always loaded, you are encouraged to keep this file as +# light-weight as possible. Requiring heavyweight dependencies from this file +# will add to the boot time of your test suite on EVERY test run, even for an +# individual file that may not need all of that loaded. Instead, consider making +# a separate helper file that requires the additional dependencies and performs +# the additional setup, and require it from the spec files that actually need +# it. +# +# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration +RSpec.configure do |config| + # rspec-expectations config goes here. You can use an alternate + # assertion/expectation library such as wrong or the stdlib/minitest + # assertions if you prefer. + config.expect_with :rspec do |expectations| + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end + + # rspec-mocks config goes here. You can use an alternate test double + # library (such as bogus or mocha) by changing the `mock_with` option here. + config.mock_with :rspec do |mocks| + # Prevents you from mocking or stubbing a method that does not exist on + # a real object. This is generally recommended, and will default to + # `true` in RSpec 4. + mocks.verify_partial_doubles = true + end + + # This option will default to `:apply_to_host_groups` in RSpec 4 (and will + # have no way to turn it off -- the option exists only for backwards + # compatibility in RSpec 3). It causes shared context metadata to be + # inherited by the metadata hash of host groups and examples, rather than + # triggering implicit auto-inclusion in groups with matching metadata. + config.shared_context_metadata_behavior = :apply_to_host_groups + + # The settings below are suggested to provide a good initial experience + # with RSpec, but feel free to customize to your heart's content. + # # This allows you to limit a spec run to individual examples or groups + # # you care about by tagging them with `:focus` metadata. When nothing + # # is tagged with `:focus`, all examples get run. RSpec also provides + # # aliases for `it`, `describe`, and `context` that include `:focus` + # # metadata: `fit`, `fdescribe` and `fcontext`, respectively. + # config.filter_run_when_matching :focus + # + # # Allows RSpec to persist some state between runs in order to support + # # the `--only-failures` and `--next-failure` CLI options. We recommend + # # you configure your source control system to ignore this file. + # config.example_status_persistence_file_path = "spec/examples.txt" + # + # # Limits the available syntax to the non-monkey patched syntax that is + # # recommended. For more details, see: + # # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ + # # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ + # # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode + # config.disable_monkey_patching! + # + # # Many RSpec users commonly either run the entire suite or an individual + # # file, and it's useful to allow more verbose output when running an + # # individual spec file. + # if config.files_to_run.one? + # # Use the documentation formatter for detailed output, + # # unless a formatter has already been configured + # # (e.g. via a command-line flag). + # config.default_formatter = "doc" + # end + # + # # Print the 10 slowest examples and example groups at the + # # end of the spec run, to help surface which specs are running + # # particularly slow. + # config.profile_examples = 10 + # + # # Run specs in random order to surface order dependencies. If you find an + # # order dependency and want to debug it, you can fix the order by providing + # # the seed, which is printed after each run. + # # --seed 1234 + # config.order = :random + # + # # Seed global randomization in this process using the `--seed` CLI option. + # # Setting this allows you to use `--seed` to deterministically reproduce + # # test failures related to randomization by passing the same `--seed` value + # # as the one that triggered the failure. + # Kernel.srand config.seed +end diff --git a/playbook-website/test/application_system_test_case.rb b/playbook-website/test/application_system_test_case.rb deleted file mode 100644 index c05709aff8..0000000000 --- a/playbook-website/test/application_system_test_case.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -require "test_helper" - -class ApplicationSystemTestCase < ActionDispatch::SystemTestCase - driven_by :selenium, using: :chrome, screen_size: [1400, 1400] -end diff --git a/playbook-website/test/controllers/.keep b/playbook-website/test/controllers/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/playbook-website/test/fixtures/.keep b/playbook-website/test/fixtures/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/playbook-website/test/fixtures/files/.keep b/playbook-website/test/fixtures/files/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/playbook-website/test/helpers/.keep b/playbook-website/test/helpers/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/playbook-website/test/integration/.keep b/playbook-website/test/integration/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/playbook-website/test/menu_yml_spec.rb b/playbook-website/test/menu_yml_spec.rb deleted file mode 100644 index 0ee066d7e4..0000000000 --- a/playbook-website/test/menu_yml_spec.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -require "yaml" - -yaml_file_path = File.expand_path("../../../playbook/playbook-website/config/menu.yml", __dir__) - -RSpec.describe "Menu YAML File" do - let(:data) { YAML.safe_load(File.read(yaml_file_path), aliases: true) } - - it "should load YAML file without errors" do - expect(data).to_not be_nil - end - - it "should have categories defined" do - expect(data).to have_key("kits") - expect(data["kits"]).to be_an(Array) - expect(data["kits"]).to_not be_empty - end - - it "should have components defined for each category" do - data["kits"].each do |kit| - expect(kit).to have_key("category") - expect(kit["category"]).to be_a(String) - expect(kit).to have_key("components") - expect(kit["components"]).to be_an(Array) - expect(kit["components"]).to_not be_empty - - kit["components"].each do |component| - expect(component).to have_key("name") - expect(component["name"]).to be_a(String) - expect(component).to have_key("platforms") - expect(component["platforms"]).to be_an(Array) - expect(component["platforms"]).to_not be_empty - end - end - end -end diff --git a/playbook-website/test/models/.keep b/playbook-website/test/models/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/playbook-website/test/system/.keep b/playbook-website/test/system/.keep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/playbook-website/test/test_helper.rb b/playbook-website/test/test_helper.rb deleted file mode 100644 index dfce59178f..0000000000 --- a/playbook-website/test/test_helper.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -ENV["RAILS_ENV"] ||= "test" -require_relative "../config/environment" -require "rails/test_help" - -module ActiveSupport - class TestCase - # Add more helper methods to be used by all tests here... - end -end