Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test omniauth and selenium web driver, capybara test #23

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ config/master.key
## Environment normalization:
/.bundle
/vendor/bundle

/.local
/.webdrivers
/.cache
# these should all be checked in to normalize the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset

Expand Down
168 changes: 164 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ AllCops:
- 'out/**/*'
# Exclude vendor files in GitHub build
- 'vendor/**/*'
NewCops: enable
SuggestExtensions: false

# Allow one line around block body (Layout/EmptyLines will still disallow two or more)
Layout/EmptyLinesAroundBlockBody:
Expand Down Expand Up @@ -345,9 +347,167 @@ Rails/RootJoinChain: # new in 2.13
Enabled: true

# to skip default code generation
Layout/ClassLength:
Metrics/ClassLength:
Enabled: false
Layout/MethodLength:
Metrics/MethodLength:
Enabled: false
Layout/BlockLength:
Enabled: false
Metrics/BlockLength:
Enabled: false

# enable new cops
Gemspec/DevelopmentDependencies: # new in 1.44
Enabled: true
Layout/LineContinuationLeadingSpace: # new in 1.31
Enabled: true
Layout/LineContinuationSpacing: # new in 1.31
Enabled: true
Lint/ConstantOverwrittenInRescue: # new in 1.31
Enabled: true
Lint/DuplicateMagicComment: # new in 1.37
Enabled: true
Lint/DuplicateMatchPattern: # new in 1.50
Enabled: true
Lint/ItWithoutArgumentsInBlock: # new in 1.59
Enabled: true
Lint/LiteralAssignmentInCondition: # new in 1.58
Enabled: true
Lint/MixedCaseRange: # new in 1.53
Enabled: true
Lint/NonAtomicFileOperation: # new in 1.31
Enabled: true
Lint/RedundantRegexpQuantifiers: # new in 1.53
Enabled: true
Lint/RefinementImportMethods: # new in 1.27
Enabled: true
Lint/RequireRangeParentheses: # new in 1.32
Enabled: true
Lint/UselessRescue: # new in 1.43
Enabled: true
Metrics/CollectionLiteralLength: # new in 1.47
Enabled: true
Security/CompoundHash: # new in 1.28
Enabled: true
Style/ArrayIntersect: # new in 1.40
Enabled: false
Style/ComparableClamp: # new in 1.44
Enabled: true
Style/ConcatArrayLiterals: # new in 1.41
Enabled: true
Style/DataInheritance: # new in 1.49
Enabled: true
Style/DirEmpty: # new in 1.48
Enabled: true
Style/EmptyHeredoc: # new in 1.32
Enabled: true
Style/EnvHome: # new in 1.29
Enabled: true
Style/ExactRegexpMatch: # new in 1.51
Enabled: true
Style/FetchEnvVar: # new in 1.28
Enabled: true
Style/FileEmpty: # new in 1.48
Enabled: true
Style/MagicCommentFormat: # new in 1.35
Enabled: true
Style/MapCompactWithConditionalBlock: # new in 1.30
Enabled: true
Style/MapIntoArray: # new in 1.63
Enabled: true
Style/MapToSet: # new in 1.42
Enabled: true
Style/MinMaxComparison: # new in 1.42
Enabled: true
Style/ObjectThen: # new in 1.28
Enabled: true
Style/OperatorMethodCall: # new in 1.37
Enabled: true
Style/RedundantArrayConstructor: # new in 1.52
Enabled: true
Style/RedundantConstantBase: # new in 1.40
Enabled: true
Style/RedundantCurrentDirectoryInPath: # new in 1.53
Enabled: true
Style/RedundantDoubleSplatHashBraces: # new in 1.41
Enabled: true
Style/RedundantEach: # new in 1.38
Enabled: true
Style/RedundantFilterChain: # new in 1.52
Enabled: true
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
Enabled: true
Style/RedundantInitialize: # new in 1.27
Enabled: true
Style/RedundantLineContinuation: # new in 1.49
Enabled: true
Style/RedundantRegexpArgument: # new in 1.53
Enabled: true
Style/RedundantRegexpConstructor: # new in 1.52
Enabled: true
Style/RedundantStringEscape: # new in 1.37
Enabled: true
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
Enabled: true
Style/SingleLineDoEndBlock: # new in 1.57
Enabled: true
Style/SuperWithArgsParentheses: # new in 1.58
Enabled: true
Style/YAMLFileRead: # new in 1.53
Enabled: true
Rails/ActionControllerFlashBeforeRender: # new in 2.16
Enabled: true
Rails/ActionControllerTestCase: # new in 2.14
Enabled: true
Rails/ActionOrder: # new in 2.17
Enabled: true
Rails/ActiveSupportOnLoad: # new in 2.16
Enabled: true
Rails/DangerousColumnNames: # new in 2.21
Enabled: true
Rails/DeprecatedActiveModelErrorsMethods: # new in 2.14
Enabled: true
Rails/DotSeparatedKeys: # new in 2.15
Enabled: true
Rails/DuplicateAssociation: # new in 2.14
Enabled: true
Rails/DuplicateScope: # new in 2.14
Enabled: true
Rails/EnvLocal: # new in 2.22
Enabled: true
Rails/FreezeTime: # new in 2.16
Enabled: true
Rails/I18nLazyLookup: # new in 2.14
Enabled: true
Rails/I18nLocaleTexts: # new in 2.14
Enabled: false
Rails/IgnoredColumnsAssignment: # new in 2.17
Enabled: true
Rails/MigrationClassName: # new in 2.14
Enabled: true
Rails/RedundantActiveRecordAllMethod: # new in 2.21
Enabled: true
Rails/ResponseParsedBody: # new in 2.18
Enabled: true
Rails/RootPathnameMethods: # new in 2.16
Enabled: true
Rails/RootPublicPath: # new in 2.15
Enabled: true
Rails/SelectMap: # new in 2.21
Enabled: true
Rails/StripHeredoc: # new in 2.15
Enabled: true
Rails/ThreeStateBooleanColumn: # new in 2.19
Enabled: true
Rails/ToFormattedS: # new in 2.15
Enabled: true
Rails/ToSWithArgument: # new in 2.16
Enabled: true
Rails/TopLevelHashWithIndifferentAccess: # new in 2.16
Enabled: true
Rails/TransactionExitStatement: # new in 2.14
Enabled: true
Rails/UnusedRenderContent: # new in 2.21
Enabled: true
Rails/WhereMissing: # new in 2.16
Enabled: true
Rails/WhereNotWithMultipleConditions: # new in 2.17
Enabled: true
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ gem 'geoblacklight', '~> 4.1.1'
gem 'importmap-rails'
gem 'jbuilder'
gem 'jquery-rails'
gem 'omniauth', '< 2.0'
gem 'omniauth-cas'
gem 'omniauth'
gem 'omniauth-cas', '3.0.0'
gem 'omniauth-rails_csrf_protection', '~> 1.0'
gem 'pg', '~> 1.4.6'
gem 'puma', '~> 6.4.1'
gem 'rack-timeout', '~> 0.6.3'
Expand Down
66 changes: 39 additions & 27 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ GEM
connection_pool (2.4.1)
crass (1.0.6)
date (3.3.4)
debug (1.9.1)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
deep_merge (1.2.2)
Expand Down Expand Up @@ -208,8 +208,8 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.7.1)
json-schema (4.2.0)
json (2.7.2)
json-schema (4.3.0)
addressable (>= 2.8)
kaminari (1.2.2)
activesupport (>= 4.1.0)
Expand Down Expand Up @@ -261,9 +261,9 @@ GEM
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.4.0.1)
net-smtp (0.5.0)
net-protocol
nio4r (2.7.0)
nio4r (2.7.1)
nokogiri (1.16.3-aarch64-linux)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-darwin)
Expand All @@ -272,13 +272,17 @@ GEM
racc (~> 1.4)
oj (3.16.3)
bigdecimal (>= 3.0)
omniauth (1.9.2)
omniauth (2.1.2)
hashie (>= 3.4.6)
rack (>= 1.6.2, < 3)
omniauth-cas (2.0.0)
addressable (~> 2.3)
nokogiri (~> 1.5)
omniauth (~> 1.2)
rack (>= 2.2.3)
rack-protection
omniauth-cas (3.0.0)
addressable (~> 2.8)
nokogiri (~> 1.12)
omniauth (~> 2.1)
omniauth-rails_csrf_protection (1.0.1)
actionpack (>= 4.2)
omniauth (~> 2.0)
orm_adapter (0.5.0)
ostruct (0.6.0)
ougai (1.9.1)
Expand All @@ -291,11 +295,14 @@ GEM
popper_js (1.16.1)
psych (5.1.2)
stringio
public_suffix (5.0.4)
public_suffix (5.0.5)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
rack (2.2.9)
rack-protection (3.2.0)
base64 (>= 0.1.0)
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0)
rack (>= 1.3)
rack-timeout (0.6.3)
Expand Down Expand Up @@ -328,12 +335,12 @@ GEM
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.1.0)
rake (13.2.1)
rchardet (1.8.0)
rdoc (6.6.2)
rdoc (6.6.3.1)
psych (>= 4.0.0)
regexp_parser (2.9.0)
reline (0.4.3)
reline (0.5.0)
io-console (~> 0.5)
request_store (1.6.0)
rack (>= 1.4)
Expand All @@ -345,7 +352,7 @@ GEM
rgeo (3.0.1)
rgeo-geojson (2.1.1)
rgeo (>= 1.0.0)
rsolr (2.5.0)
rsolr (2.6.0)
builder (>= 2.1.2)
faraday (>= 0.9, < 3, != 2.0.0)
rspec-core (3.13.0)
Expand All @@ -356,18 +363,18 @@ GEM
rspec-mocks (3.13.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (6.1.1)
rspec-rails (6.1.2)
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-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.62.1)
rubocop (1.63.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -384,15 +391,18 @@ GEM
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-rails (2.24.0)
rubocop-rails (2.24.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.27.1)
rubocop-rspec (2.29.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.2)
rubocop (~> 1.40)
ruby-progressbar (1.13.0)
rubyzip (2.3.2)
sanitize (6.1.0)
Expand Down Expand Up @@ -423,7 +433,8 @@ GEM
minitar
retriable
ruby-progressbar
sprockets (3.7.2)
sprockets (3.7.3)
base64
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.2)
Expand Down Expand Up @@ -491,8 +502,9 @@ DEPENDENCIES
importmap-rails
jbuilder
jquery-rails
omniauth (< 2.0)
omniauth-cas
omniauth
omniauth-cas (= 3.0.0)
omniauth-rails_csrf_protection (~> 1.0)
pg (~> 1.4.6)
puma (~> 6.4.1)
rack-timeout (~> 0.6.3)
Expand Down
7 changes: 4 additions & 3 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ def allow_geoblacklight_params
blacklight_config.search_state_fields.append(Settings.GBL_PARAMS)
end

# root will be used as new_session_path
# Shim because we're not using Devise's :database_authenticatable
def new_session_path(_scope)
new_user_session_path
end
# def new_session_path(_scope)
# new_user_session_path
# end

# @param [String] return_url address that calnet will redirect to post-logout
# @return [String] uri to the calnet sso page
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class SessionsController < ApplicationController
def new
return_url = params[:url] || request.referer || root_path
redirect_to user_calnet_omniauth_authorize_path(url: return_url)
end
# def new
# return_url = params[:url] || request.referer || root_path
# redirect_to user_calnet_omniauth_authorize_path(url: return_url)
# end

def destroy
sign_out current_user if signed_in?
Expand Down
Loading
Loading