Skip to content

Commit

Permalink
Fix session secret error in tests with rails 71
Browse files Browse the repository at this point in the history
  • Loading branch information
mperham committed Apr 22, 2024
1 parent 33006ba commit e57a47e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -3,7 +3,7 @@ source "https://rubygems.org"
gemspec

gem "rake"
RAILS_VERSION = "~> 7.0.4"
RAILS_VERSION = "~> 7.1"
gem "actionmailer", RAILS_VERSION
gem "actionpack", RAILS_VERSION
gem "activejob", RAILS_VERSION
Expand Down
9 changes: 6 additions & 3 deletions test/web_test.rb
Expand Up @@ -20,6 +20,9 @@ def add_pair(job)

describe Sidekiq::Web do
include Rack::Test::Methods
def session_secret
"v3rys3cr31v3rys3cr31v3rys3cr31v3rys3cr31v3rys3cr31v3rys3cr31mike!"
end

def app
@app ||= Sidekiq::Web.new
Expand Down Expand Up @@ -927,7 +930,7 @@ def app

def app
app = Sidekiq::Web.new
app.use Rack::Session::Cookie, secret: "v3rys3cr31", host: "nicehost.org"
app.use Rack::Session::Cookie, secret: session_secret, host: "nicehost.org"
app
end

Expand All @@ -936,7 +939,7 @@ def app

session_options = last_request.env["rack.session"].options

assert_equal "v3rys3cr31", session_options[:secret]
assert_equal session_secret, session_options[:secret]
assert_equal "nicehost.org", session_options[:host]
end
end
Expand All @@ -957,7 +960,7 @@ def app

def app
app = Sidekiq::Web.new
app.use Rack::Session::Cookie, secret: "v3rys3cr31", host: "nicehost.org"
app.use Rack::Session::Cookie, secret: session_secret, host: "nicehost.org"
app
end

Expand Down

0 comments on commit e57a47e

Please sign in to comment.