Skip to content

Commit

Permalink
Rolling back Ruby 3.3 again....
Browse files Browse the repository at this point in the history
  • Loading branch information
martyn-w committed Dec 3, 2024
1 parent 058e6b6 commit 3557fa2
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"version": "latest"
},
"ghcr.io/devcontainers/features/ruby:1": {
"version": "3.3.6"
"version": "3.1.4"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "18.16"
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.6
3.1.4
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
terraform 1.5.4
ruby 3.3.6
ruby 3.1.4
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# To use or update to a ruby version, change BASE_RUBY_IMAGE
ARG BASE_RUBY_IMAGE=ruby:3.3.6-alpine3.20
ARG BASE_RUBY_IMAGE=ruby:3.1.4-alpine3.18

FROM ${BASE_RUBY_IMAGE} AS base

Expand Down
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,13 @@ group :development, :test do

# Testing framework
gem "knapsack"
gem "rspec-rails", "~> 7.1.0"
gem "rspec-rails", "~> 6.0.3"

# Adds support for Capybara system testing and selenium driver
gem "capybara", "~> 3.40.0"
gem "factory_bot_rails", ">= 6.2.0"
gem "rspec-sonarqube-formatter", "~> 1.6.1", require: false
# See: https://github.com/otherguy/rspec-sonarqube-formatter/pull/63
gem "rspec-sonarqube-formatter", github: "otherguy/rspec-sonarqube-formatter", ref: "13fe436", require: false
gem "simplecov"

# Linting
Expand Down
64 changes: 35 additions & 29 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ GIT
activemodel (>= 6.0.0, < 7.1)
timeliness (>= 0.3.10, < 1)

GIT
remote: https://github.com/otherguy/rspec-sonarqube-formatter.git
revision: 13fe436921e1442a09c23d9e46055773d1511638
ref: 13fe436
specs:
rspec-sonarqube-formatter (1.0.0.pre.local)
htmlentities (~> 4.3.3)
rspec (~> 3.0)

GIT
remote: https://github.com/pkorenev/rack-page_caching.git
revision: 9ca404f7f7e4773030e75799da7ab02e27cbe9a3
Expand Down Expand Up @@ -196,7 +205,7 @@ GEM
csv (3.3.0)
declarative (0.0.20)
delegate (0.3.1)
diff-lcs (1.5.1)
diff-lcs (1.5.0)
docile (1.4.0)
dotenv (3.1.2)
dotenv-rails (3.1.2)
Expand Down Expand Up @@ -391,10 +400,10 @@ GEM
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.16.7)
nokogiri (1.16.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
nokogiri (1.16.5-x86_64-linux)
racc (~> 1.4)
observer (0.1.1)
os (1.1.4)
Expand Down Expand Up @@ -488,32 +497,29 @@ GEM
rexml (3.3.3)
strscan
rinku (2.0.6)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.2)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.3)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.0)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.2)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (7.1.0)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (~> 3.12.0)
rspec-rails (6.0.3)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.12)
rspec-expectations (~> 3.12)
rspec-mocks (~> 3.12)
rspec-support (~> 3.12)
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-sonarqube-formatter (1.6.1)
htmlentities (~> 4.3)
rspec (~> 3.0)
rspec-support (3.13.1)
rspec-support (3.12.0)
rubocop (1.64.1)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
Expand Down Expand Up @@ -632,7 +638,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.7.1)
zeitwerk (2.6.18)

PLATFORMS
ruby
Expand Down Expand Up @@ -700,9 +706,9 @@ DEPENDENCIES
redis-session-store (>= 0.11.4)
rexml (>= 3.2.5)
rinku
rspec-rails (~> 7.1.0)
rspec-rails (~> 6.0.3)
rspec-retry
rspec-sonarqube-formatter (~> 1.6.1)
rspec-sonarqube-formatter!
rubocop-govuk (~> 5.0.2)
secure_headers
selenium-webdriver (~> 4.21.1)
Expand All @@ -726,7 +732,7 @@ DEPENDENCIES
webmock (>= 3.14.0)

RUBY VERSION
ruby 3.3.6
ruby 3.1.4p223

BUNDLED WITH
2.3.4
3 changes: 0 additions & 3 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

# Patch to Rack::PageCaching::Utils to substitute Fixnum --> Integer
require_relative "../lib/patch_rack_page_caching"

module GetIntoTeachingWebsite
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@
config.x.dfe_analytics = true

# Allow access from Codespaces
config.hosts << /[a-z0-9-]+\.((preview\.)?app\.github|githubpreview)\.dev/
config.hosts << /[a-z0-9-]+\.(preview\.app\.github|githubpreview)\.dev/
end
19 changes: 0 additions & 19 deletions lib/patch_rack_page_caching.rb

This file was deleted.

4 changes: 0 additions & 4 deletions spec/capybara_driver_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
Capybara.default_max_wait_time = 2
RSpec.configure do |config|
config.before do |example|
if example.metadata[:js]
raise NotImplementedError, "The Capybara driver #{JS_DRIVER} is not currently supported in Alpine 3.20. Please use the default :rack_test driver instead and test javascript behaviour in js-spec tests"
end

Capybara.current_driver = JS_DRIVER if example.metadata[:js]
Capybara.current_driver = :selenium if example.metadata[:selenium]
Capybara.current_driver = :selenium_chrome if example.metadata[:selenium_chrome]
Expand Down
60 changes: 41 additions & 19 deletions spec/features/chat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,66 @@
before do
allow(ENV).to receive(:fetch).and_call_original
allow(ENV).to receive(:fetch).with("CHAT_AVAILABILITY_API", nil).and_return("http://api.example/")
stub_request(:get, "http://api.example/")
.to_return(status: 200, body: "{\"skillid\": 123456, \"available\": false, \"status_age\": 123 }")
end

context "when agents are available" do
before do
stub_request(:get, "http://api.example/")
.to_return(status: 200, body: "{\"skillid\": 123456, \"available\": true, \"status_age\": 123 }")
end
context "when javascript is enabled", :js do
context "when agents are available" do
before do
stub_request(:get, "http://api.example/")
.to_return(status: 200, body: "{\"skillid\": 123456, \"available\": true, \"status_age\": 123 }")
end

scenario "viewing the chat section of the talk to us component" do
visit root_path
dismiss_cookies
scenario "viewing the chat section of the talk to us component" do
visit root_path
dismiss_cookies

within(".talk-to-us") do
click_link("Open chat in new tab")
end
within(".talk-to-us") do
click_link("Open chat in new tab")
end

expect(page.driver.current_url).to end_with("/chat#root")
expect(page).to have_css("#root", visible: false)
popup_window_handle = (page.driver.browser.window_handles - [page.driver.current_window_handle]).first
page.driver.switch_to_window(popup_window_handle)
expect(page.driver.current_url).to end_with("/chat")
expect(page).to have_css("#root", visible: false)
page.driver.close_window(popup_window_handle)
end
end
end

context "when agents are not available" do
before do
stub_request(:get, "http://api.example/")
.to_return(status: 200, body: "{\"skillid\": 123456, \"available\": false, \"status_age\": 123 }")
context "when agents are not available" do
before do
stub_request(:get, "http://api.example/")
.to_return(status: 200, body: "{\"skillid\": 123456, \"available\": false, \"status_age\": 123 }")
end

scenario "viewing the chat section of the talk to us component" do
visit root_path
dismiss_cookies

within(".talk-to-us") do
expect(page).to have_text("Chat is closed")
end
end
end
end

context "when javascript is not enabled", js: false do
scenario "viewing the chat section of the talk to us component" do
visit root_path
dismiss_cookies

within(".talk-to-us") do
expect(page).to have_text("Chat is closed")
expect(page).to have_text("Chat not available")
end
end
end

def dismiss_cookies
click_link "Accept all cookies"
end

def visit_on_date(path)
visit "#{path}?fake_browser_time=#{date.to_i * 1000}"
end
end
1 change: 1 addition & 0 deletions spec/javascript/controllers/chat_controller_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,5 @@ describe('ChatController', () => {
})
});
});

});

0 comments on commit 3557fa2

Please sign in to comment.