diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a398fdaf3..80380bd77 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,9 @@ jobs: bundler-cache: true - name: "Reset app database" - run: bundle exec rake dummy:db:reset + run: | + bundle exec rake dummy:db:drop + bundle exec rake dummy:db:setup - name: "Run tests" run: bundle exec rake diff --git a/bin/setup b/bin/setup index 2000a17c3..63cb3481e 100755 --- a/bin/setup +++ b/bin/setup @@ -12,4 +12,5 @@ if [ -z "$CI" ]; then fi # Set up database for the application that Clearance tests against -RAILS_ENV=test bundle exec rake dummy:db:reset +RAILS_ENV=test bundle exec rake dummy:db:drop +RAILS_ENV=test bundle exec rake dummy:db:setup diff --git a/lib/clearance/testing/deny_access_matcher.rb b/lib/clearance/testing/deny_access_matcher.rb index ac44a04b0..470daa3ce 100644 --- a/lib/clearance/testing/deny_access_matcher.rb +++ b/lib/clearance/testing/deny_access_matcher.rb @@ -90,7 +90,7 @@ def redirects_to_url? @failure_message_when_negated << "Didn't expect to redirect to #{@url}." true - rescue MiniTest::Assertion, ::Test::Unit::AssertionFailedError + rescue Minitest::Assertion, ::Test::Unit::AssertionFailedError @failure_message << "Expected to redirect to #{@url} but did not." false end diff --git a/spec/clearance/session_spec.rb b/spec/clearance/session_spec.rb index 556611545..ec5517f21 100644 --- a/spec/clearance/session_spec.rb +++ b/spec/clearance/session_spec.rb @@ -472,7 +472,8 @@ def serialize_cookies(hash) Rack::Utils.set_cookie_header! header, key, value end - header['Set-Cookie'] + cookie = header["set-cookie"] || header["Set-Cookie"] + cookie end def have_been_called diff --git a/spec/dummy/application.rb b/spec/dummy/application.rb index c559198ae..03e56572b 100644 --- a/spec/dummy/application.rb +++ b/spec/dummy/application.rb @@ -19,12 +19,6 @@ class Application < Rails::Application config.paths["log"] = "tmp/log/development.log" config.paths.add "config/routes.rb", with: "#{APP_ROOT}/config/routes.rb" - if Rails.version.match?(/^6.0/) - config.active_record.sqlite3.represent_boolean_as_integer = true - else - config.active_record.legacy_connection_handling = false - end - def require_environment! initialize! end diff --git a/spec/requests/cookie_options_spec.rb b/spec/requests/cookie_options_spec.rb index aeaca9270..a2213d7e3 100644 --- a/spec/requests/cookie_options_spec.rb +++ b/spec/requests/cookie_options_spec.rb @@ -40,7 +40,7 @@ it { should_have_one_remember_token } it "should have the httponly flag set" do - expect(remember_token_cookies.last).to match(/HttpOnly/) + expect(remember_token_cookies.last.downcase).to match(/httponly/) end end end diff --git a/spec/support/cookies.rb b/spec/support/cookies.rb index 11c2f9520..fd608b9d5 100644 --- a/spec/support/cookies.rb +++ b/spec/support/cookies.rb @@ -36,7 +36,7 @@ def expectation end def extract_cookies - @cookie_headers = @headers['Set-Cookie'] || [] + @cookie_headers = @headers["Set-Cookie"] || @headers["set-cookie"] || [] @cookie_headers = [@cookie_headers] if @cookie_headers.respond_to?(:to_str) end diff --git a/spec/support/request_with_remember_token.rb b/spec/support/request_with_remember_token.rb index ba3d6b0f8..8f9dc2fd9 100644 --- a/spec/support/request_with_remember_token.rb +++ b/spec/support/request_with_remember_token.rb @@ -16,7 +16,8 @@ def request_without_remember_token end def remember_token_cookies - cookie_lines = headers["Set-Cookie"].lines.map(&:chomp) + set_cookie_header = headers["Set-Cookie"] || headers["set-cookie"] + cookie_lines = Array(set_cookie_header).join("\n").lines.map(&:chomp) cookie_lines.select { |name| name =~ /^remember_token/ } end end