repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/test_case/one_cookie_no_spaces_servlet.rb | lib/mechanize/test_case/one_cookie_no_spaces_servlet.rb | # frozen_string_literal: true
class OneCookieNoSpacesServlet < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req, res)
cookie = WEBrick::Cookie.new("foo", "bar")
cookie.path = "/"
cookie.expires = Time.now + 86400
res.cookies << cookie.to_s.gsub(/; /, ';')
res['Content-Type'] = "text/html"
... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/test_case/form_servlet.rb | lib/mechanize/test_case/form_servlet.rb | # frozen_string_literal: true
class FormServlet < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req, res)
res.content_type = 'text/html'
query = []
req.query.each_key { |k|
key = WEBrick::HTTPUtils.unescape k
req.query[k].each_data { |data|
value = WEBrick::HTTPUtils.unescape dat... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/test_case/server.rb | lib/mechanize/test_case/server.rb | # frozen_string_literal: true
require 'webrick'
require 'mechanize/test_case/servlets'
server = WEBrick::HTTPServer.new :Port => 8000
server.mount_proc '/' do |req, res|
res.content_type = 'text/html'
servlets = MECHANIZE_TEST_CASE_SERVLETS.map do |path, servlet|
"<dt>#{servlet}<dd><a href=\"#{path}\">#{path}... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/test_case/redirect_servlet.rb | lib/mechanize/test_case/redirect_servlet.rb | # frozen_string_literal: true
class RedirectServlet < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req, res)
res['Content-Type'] = req.query['ct'] || 'text/html'
res.status = req.query['code'] ? req.query['code'].to_i : '302'
res['Location'] = req['X-Location'] || '/verb'
end
alias :do_POST :do_G... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/test_case/basic_auth_servlet.rb | lib/mechanize/test_case/basic_auth_servlet.rb | # frozen_string_literal: true
class BasicAuthServlet < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req,res)
htpd = nil
Tempfile.open 'dot.htpasswd' do |io|
htpd = WEBrick::HTTPAuth::Htpasswd.new(io.path)
htpd.set_passwd('Blah', 'user', 'pass')
end
authenticator = WEBrick::HTTPAuth::B... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/test_case/bad_chunking_servlet.rb | lib/mechanize/test_case/bad_chunking_servlet.rb | # frozen_string_literal: true
class BadChunkingServlet < WEBrick::HTTPServlet::AbstractServlet
def do_GET req, res
res.keep_alive = false if res.respond_to? :keep_alive=
res['Transfer-Encoding'] = 'chunked'
res.body = <<-BODY
a\r
0123456789\r
0\r
BODY
end
end
| ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/test_case/refresh_without_url.rb | lib/mechanize/test_case/refresh_without_url.rb | # frozen_string_literal: true
class RefreshWithoutUrl < WEBrick::HTTPServlet::AbstractServlet
@@count = 0
def do_GET(req, res)
address = "#{req.host}:#{req.port}"
res['Content-Type'] = "text/html"
@@count += 1
if @@count > 1
res['Refresh'] = "0; url=http://#{address}/";
else
res['Ref... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/test_case/digest_auth_servlet.rb | lib/mechanize/test_case/digest_auth_servlet.rb | # frozen_string_literal: true
require 'logger'
class DigestAuthServlet < WEBrick::HTTPServlet::AbstractServlet
htpd = nil
Tempfile.open 'digest.htpasswd' do |io|
htpd = WEBrick::HTTPAuth::Htdigest.new(io.path)
htpd.set_passwd('Blah', 'user', 'pass')
end
@@authenticator = WEBrick::HTTPAuth::DigestAuth... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/test_case/verb_servlet.rb | lib/mechanize/test_case/verb_servlet.rb | # frozen_string_literal: true
class VerbServlet < WEBrick::HTTPServlet::AbstractServlet
%w[HEAD GET POST PUT DELETE].each do |verb|
define_method "do_#{verb}" do |req, res|
res.header['X-Request-Method'] = verb
res.body = verb
end
end
end
| ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/test_case/quoted_value_cookie_servlet.rb | lib/mechanize/test_case/quoted_value_cookie_servlet.rb | # frozen_string_literal: true
class QuotedValueCookieServlet < WEBrick::HTTPServlet::AbstractServlet
def do_GET(req, res)
cookie = WEBrick::Cookie.new("quoted", "\"value\"")
cookie.path = "/"
cookie.expires = Time.now + 86400
res.cookies << cookie
res['Content-Type'] = "text/html"
res.body = "... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/page/meta_refresh.rb | lib/mechanize/page/meta_refresh.rb | # frozen_string_literal: true
##
# This class encapsulates a meta element with a refresh http-equiv. Mechanize
# treats meta refresh elements just like 'a' tags. MetaRefresh objects will
# contain links, but most likely will have no text.
class Mechanize::Page::MetaRefresh < Mechanize::Page::Link
##
# Time to w... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/page/frame.rb | lib/mechanize/page/frame.rb | # frozen_string_literal: true
# A Frame object wraps a frame HTML element. Frame objects can be treated
# just like Link objects. They contain #src, the #link they refer to and a
# #name, the name of the frame they refer to. #src and #name are aliased to
# #href and #text respectively so that a Frame object can be t... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/page/link.rb | lib/mechanize/page/link.rb | # frozen_string_literal: true
##
# This class encapsulates links. It contains the text and the URI for
# 'a' tags parsed out of an HTML page. If the link contains an image,
# the alt text will be used for that image.
#
# For example, the text for the following links with both be 'Hello World':
#
# <a href="http://e... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/page/base.rb | lib/mechanize/page/base.rb | # frozen_string_literal: true
##
# A base element on an HTML page. Mechanize treats base tags just like 'a'
# tags. Base objects will contain links, but most likely will have no text.
class Mechanize::Page::Base < Mechanize::Page::Link
end
| ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/page/image.rb | lib/mechanize/page/image.rb | # frozen_string_literal: true
##
# An image element on an HTML page
class Mechanize::Page::Image
attr_reader :node
attr_accessor :page
attr_accessor :mech
##
# Creates a new Mechanize::Page::Image from an image +node+ and source
# +page+.
def initialize node, page
@node = node
@page = page
... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/page/label.rb | lib/mechanize/page/label.rb | # frozen_string_literal: true
##
# A form label on an HTML page
class Mechanize::Page::Label
attr_reader :node
attr_reader :text
attr_reader :page
alias :to_s :text
def initialize(node, page)
@node = node
@text = node.inner_text
@page = page
end
def for
(id = @node['for']) && page.searc... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/textarea.rb | lib/mechanize/form/textarea.rb | # frozen_string_literal: true
class Mechanize::Form::Textarea < Mechanize::Form::Field
end
| ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/submit.rb | lib/mechanize/form/submit.rb | # frozen_string_literal: true
class Mechanize::Form::Submit < Mechanize::Form::Button
end
| ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/text.rb | lib/mechanize/form/text.rb | # frozen_string_literal: true
class Mechanize::Form::Text < Mechanize::Form::Field
end
| ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/hidden.rb | lib/mechanize/form/hidden.rb | # frozen_string_literal: true
class Mechanize::Form::Hidden < Mechanize::Form::Field
end
| ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/image_button.rb | lib/mechanize/form/image_button.rb | # frozen_string_literal: true
##
# This class represents an image button in a form. Use the x and y methods to
# set the x and y positions for where the mouse "clicked".
class Mechanize::Form::ImageButton < Mechanize::Form::Button
attr_accessor :x, :y
def initialize *args
@x = nil
@y = nil
super
en... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/check_box.rb | lib/mechanize/form/check_box.rb | # frozen_string_literal: true
##
# This class represents a check box found in a Form. To activate the CheckBox
# in the Form, set the checked method to true.
class Mechanize::Form::CheckBox < Mechanize::Form::RadioButton
def query_value
[[@name, @value || "on"]]
end
def inspect # :nodoc:
"[%s:0x%x t... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/field.rb | lib/mechanize/form/field.rb | # frozen_string_literal: true
##
# This class represents a field in a form. It handles the following input
# tags found in a form:
#
# * text
# * password
# * hidden
# * int
# * textarea
# * keygen
#
# To set the value of a field, just use the value method:
#
# field.value = "foo"
class Mechanize::Form::Field
ext... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/radio_button.rb | lib/mechanize/form/radio_button.rb | # frozen_string_literal: true
##
# This class represents a radio button found in a Form. To activate the
# RadioButton in the Form, set the checked method to true.
class Mechanize::Form::RadioButton < Mechanize::Form::Field
attr_accessor :checked
attr_reader :form
def initialize node, form
@checked = !!nod... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/keygen.rb | lib/mechanize/form/keygen.rb | # frozen_string_literal: true
##
# This class represents a keygen (public / private key generator) found in a
# Form. The field will automatically generate a key pair and compute its own
# value to match the challenge. Call key to access the public/private key
# pair.
class Mechanize::Form::Keygen < Mechanize::Form::F... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/button.rb | lib/mechanize/form/button.rb | # frozen_string_literal: true
##
# A Submit button in a Form
class Mechanize::Form::Button < Mechanize::Form::Field
end
| ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/select_list.rb | lib/mechanize/form/select_list.rb | # frozen_string_literal: true
# This class represents a select list or drop down box in a Form. Set the
# value for the list by calling SelectList#value=. SelectList contains a list
# of Option that were found. After finding the correct option, set the select
# lists value to the option value:
#
# selectlist.value... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/option.rb | lib/mechanize/form/option.rb | # frozen_string_literal: true
##
# This class contains an option found within SelectList. A SelectList can
# have many Option classes associated with it. An option can be selected by
# calling Option#tick, or Option#click.
#
# To select the first option in a list:
#
# select_list.first.tick
class Mechanize::Form::... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/multi_select_list.rb | lib/mechanize/form/multi_select_list.rb | # frozen_string_literal: true
##
# This class represents a select list where multiple values can be selected.
# MultiSelectList#value= accepts an array, and those values are used as
# values for the select list. For example, to select multiple values,
# simply do this:
#
# list.value = ['one', 'two']
#
# Single valu... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/file_upload.rb | lib/mechanize/form/file_upload.rb | # frozen_string_literal: true
# This class represents a file upload field found in a form. To use this
# class, set FileUpload#file_data= to the data of the file you want to upload
# and FileUpload#mime_type= to the appropriate mime type of the file.
#
# See the example in EXAMPLES
class Mechanize::Form::FileUpload <... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/form/reset.rb | lib/mechanize/form/reset.rb | # frozen_string_literal: true
class Mechanize::Form::Reset < Mechanize::Form::Button
end
| ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/http/agent.rb | lib/mechanize/http/agent.rb | # frozen_string_literal: true
require 'tempfile'
require 'net/ntlm'
require 'webrobots'
##
# An HTTP (and local disk access) user agent. This class is an implementation
# detail and is subject to change at any time.
class Mechanize::HTTP::Agent
CREDENTIAL_HEADERS = ['Authorization']
COOKIE_HEADERS = ['Cookie']
... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | true |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/http/auth_store.rb | lib/mechanize/http/auth_store.rb | # frozen_string_literal: true
##
# A credential store for HTTP authentication.
#
# uri = URI 'http://example'
#
# store = Mechanize::HTTP::AuthStore.new
# store.add_auth uri, 'user1', 'pass'
# store.add_auth uri, 'user2', 'pass', 'realm'
#
# user, pass = store.credentials_for uri, 'realm' #=> 'user2', 'pass'
... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/http/auth_realm.rb | lib/mechanize/http/auth_realm.rb | # frozen_string_literal: true
class Mechanize::HTTP::AuthRealm
attr_reader :scheme
attr_reader :uri
attr_reader :realm
def initialize scheme, uri, realm
@scheme = scheme
@uri = uri
@realm = realm if realm
end
def == other
self.class === other and
@scheme == other.scheme and
... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/http/www_authenticate_parser.rb | lib/mechanize/http/www_authenticate_parser.rb | # frozen_string_literal: true
require 'strscan'
##
# Parses the WWW-Authenticate HTTP header into separate challenges.
class Mechanize::HTTP::WWWAuthenticateParser
attr_accessor :scanner # :nodoc:
##
# Creates a new header parser for WWW-Authenticate headers
def initialize
@scanner = nil
end
##
... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/http/auth_challenge.rb | lib/mechanize/http/auth_challenge.rb | # frozen_string_literal: true
class Mechanize::HTTP
AuthChallenge = Struct.new :scheme, :params, :raw
##
# A parsed WWW-Authenticate header
class AuthChallenge
##
# :attr_accessor: scheme
#
# The authentication scheme
##
# :attr_accessor: params
#
# The authentication parame... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
sparklemotion/mechanize | https://github.com/sparklemotion/mechanize/blob/4e192760df6c2311d54e527c2b07a5fa4826c5fb/lib/mechanize/http/content_disposition_parser.rb | lib/mechanize/http/content_disposition_parser.rb | # frozen_string_literal: true
# coding: BINARY
require 'strscan'
require 'time'
class Mechanize::HTTP
ContentDisposition = Struct.new :type, :filename, :creation_date,
:modification_date, :read_date, :size, :parameters
end
##
# Parser Content-Disposition headers that loosely follows RFC 2183.
#
# Beyond RFC 21... | ruby | MIT | 4e192760df6c2311d54e527c2b07a5fa4826c5fb | 2026-01-04T15:46:19.932284Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/test/jbuilder_test.rb | test/jbuilder_test.rb | require 'test_helper'
require 'active_support/inflector'
require 'jbuilder'
def jbuild(*args, &block)
Jbuilder.new(*args, &block).attributes!
end
Comment = Struct.new(:content, :id)
class NonEnumerable
def initialize(collection)
@collection = collection
end
delegate :map, :count, to: :@collection
end
c... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/test/jbuilder_generator_test.rb | test/jbuilder_generator_test.rb | require 'test_helper'
require 'rails/generators/test_case'
require 'generators/rails/jbuilder_generator'
class JbuilderGeneratorTest < Rails::Generators::TestCase
tests Rails::Generators::JbuilderGenerator
arguments %w(Post title body:text password:digest)
destination File.expand_path('../tmp', __FILE__)
setup... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/test/jbuilder_dependency_tracker_test.rb | test/jbuilder_dependency_tracker_test.rb | require 'test_helper'
require 'jbuilder/jbuilder_dependency_tracker'
class FakeTemplate
attr_reader :source, :handler
def initialize(source, handler = :jbuilder)
@source, @handler = source, handler
end
end
class JbuilderDependencyTrackerTest < ActiveSupport::TestCase
def make_tracker(name, sour... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/test/test_helper.rb | test/test_helper.rb | require "bundler/setup"
require "rails"
require "jbuilder"
require "active_support/core_ext/array/access"
require "active_support/cache/memory_store"
require "active_support/json"
require "active_model"
require 'action_controller/railtie'
require 'action_view/railtie'
require "active_support/testing/autorun"
requir... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/test/scaffold_api_controller_generator_test.rb | test/scaffold_api_controller_generator_test.rb | require 'test_helper'
require 'rails/generators/test_case'
require 'generators/rails/scaffold_controller_generator'
class ScaffoldApiControllerGeneratorTest < Rails::Generators::TestCase
tests Rails::Generators::ScaffoldControllerGenerator
arguments %w(Post title body:text images:attachments --api --skip-routes)
... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/test/scaffold_controller_generator_test.rb | test/scaffold_controller_generator_test.rb | require 'test_helper'
require 'rails/generators/test_case'
require 'generators/rails/scaffold_controller_generator'
class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
tests Rails::Generators::ScaffoldControllerGenerator
arguments %w(Post title body:text images:attachments --skip-routes)
destinat... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/test/jbuilder_template_test.rb | test/jbuilder_template_test.rb | require "test_helper"
require "action_view/testing/resolvers"
class JbuilderTemplateTest < ActiveSupport::TestCase
POST_PARTIAL = <<-JBUILDER
json.extract! post, :id, :body
json.author do
first_name, last_name = post.author_name.split(nil, 2)
json.first_name first_name
json.last_name last_n... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/jbuilder.rb | lib/jbuilder.rb | # frozen_string_literal: true
require 'active_support'
require 'jbuilder/jbuilder'
require 'jbuilder/blank'
require 'jbuilder/key_formatter'
require 'jbuilder/errors'
require 'json'
require 'active_support/core_ext/hash/deep_merge'
class Jbuilder
@@key_formatter = nil
@@ignore_nil = false
@@deep_format_keys ... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/generators/rails/jbuilder_generator.rb | lib/generators/rails/jbuilder_generator.rb | # frozen_string_literal: true
require 'rails/generators/named_base'
require 'rails/generators/resource_helpers'
module Rails
module Generators
class JbuilderGenerator < NamedBase # :nodoc:
include Rails::Generators::ResourceHelpers
source_root File.expand_path('../templates', __FILE__)
argum... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/generators/rails/scaffold_controller_generator.rb | lib/generators/rails/scaffold_controller_generator.rb | # frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/rails/scaffold_controller/scaffold_controller_generator'
module Rails
module Generators
class ScaffoldControllerGenerator
source_paths << File.expand_path('../templates', __FILE__)
hook_for :jbuilder, type: :boolean,... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/generators/rails/templates/api_controller.rb | lib/generators/rails/templates/api_controller.rb | <% if namespaced? -%>
require_dependency "<%= namespaced_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>
class <%= controller_class_name %>Controller < ApplicationController
before_action :set_<%= singular_table_name %>, only: %i[ show update destroy ]
# GET <%= route_url %>
# GET <%= ro... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/generators/rails/templates/controller.rb | lib/generators/rails/templates/controller.rb | <% if namespaced? -%>
require_dependency "<%= namespaced_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>
class <%= controller_class_name %>Controller < ApplicationController
before_action :set_<%= singular_table_name %>, only: %i[ show edit update destroy ]
# GET <%= route_url %> or <%= ro... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/jbuilder/version.rb | lib/jbuilder/version.rb | # frozen_string_literal: true
class Jbuilder < BasicObject
VERSION = "2.14.1"
end
| ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/jbuilder/jbuilder.rb | lib/jbuilder/jbuilder.rb | # frozen_string_literal: true
require 'jbuilder/version'
| ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/jbuilder/errors.rb | lib/jbuilder/errors.rb | # frozen_string_literal: true
require 'jbuilder/version'
class Jbuilder
class NullError < ::NoMethodError
def self.build(key)
message = "Failed to add #{key.to_s.inspect} property to null object"
new(message)
end
end
class ArrayError < ::StandardError
def self.build(key)
message =... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/jbuilder/key_formatter.rb | lib/jbuilder/key_formatter.rb | # frozen_string_literal: true
require 'jbuilder/jbuilder'
class Jbuilder
class KeyFormatter
def initialize(*formats, **formats_with_options)
@mutex = Mutex.new
@formats = formats
@formats_with_options = formats_with_options
@cache = {}
end
def format(key)
@mutex.synchroniz... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/jbuilder/blank.rb | lib/jbuilder/blank.rb | # frozen_string_literal: true
class Jbuilder
class Blank
def ==(other)
super || Blank === other
end
def empty?
true
end
end
end
| ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/jbuilder/jbuilder_dependency_tracker.rb | lib/jbuilder/jbuilder_dependency_tracker.rb | # frozen_string_literal: true
class Jbuilder::DependencyTracker
EXPLICIT_DEPENDENCY = /# Template Dependency: (\S+)/
# Matches:
# json.partial! "messages/message"
# json.partial!('messages/message')
#
DIRECT_RENDERS = /
\w+\.partial! # json.partial!
\(?\s* # optional par... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/jbuilder/railtie.rb | lib/jbuilder/railtie.rb | # frozen_string_literal: true
require 'rails'
require 'jbuilder/jbuilder_template'
class Jbuilder
class Railtie < ::Rails::Railtie
initializer :jbuilder do
ActiveSupport.on_load :action_view do
ActionView::Template.register_template_handler :jbuilder, JbuilderHandler
require 'jbuilder/jbui... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/jbuilder/jbuilder_template.rb | lib/jbuilder/jbuilder_template.rb | # frozen_string_literal: true
require 'jbuilder/jbuilder'
require 'jbuilder/collection_renderer'
require 'action_dispatch/http/mime_type'
require 'active_support/cache'
class JbuilderTemplate < Jbuilder
class << self
attr_accessor :template_lookup_options
end
self.template_lookup_options = { handlers: [:jb... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
rails/jbuilder | https://github.com/rails/jbuilder/blob/38339adaa9d44ba89c0dde2a795338a886941e6f/lib/jbuilder/collection_renderer.rb | lib/jbuilder/collection_renderer.rb | # frozen_string_literal: true
require 'delegate'
require 'action_view'
require 'action_view/renderer/collection_renderer'
class Jbuilder
class CollectionRenderer < ::ActionView::CollectionRenderer # :nodoc:
class ScopedIterator < ::SimpleDelegator # :nodoc:
include Enumerable
def initialize(obj, sc... | ruby | MIT | 38339adaa9d44ba89c0dde2a795338a886941e6f | 2026-01-04T15:46:22.398194Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/gemfiles/rails_7.2.rb | gemfiles/rails_7.2.rb | # frozen_string_literal: true
source "https://rubygems.org"
gemspec path: ".."
gem "activerecord", "~> 7.2.0"
gem "activesupport", "~> 7.2.0"
gem "mysql2", "~> 0.5.6"
gem "pg", "~> 1.5.8"
gem "sqlite3", "~> 2.0.0"
| ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/gemfiles/rails_8.0.rb | gemfiles/rails_8.0.rb | # frozen_string_literal: true
source "https://rubygems.org"
gemspec path: ".."
gem "activerecord", "~> 8.0.0"
gem "activesupport", "~> 8.0.0"
gem "mysql2", "~> 0.5.6"
gem "pg", "~> 1.5.8"
gem "sqlite3", "~> 2.1.0"
| ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/gemfiles/rails_8.1.rb | gemfiles/rails_8.1.rb | # frozen_string_literal: true
source "https://rubygems.org"
gemspec path: ".."
gem "activerecord", "~> 8.1.0"
gem "activesupport", "~> 8.1.0"
gem "mysql2", "~> 0.5.6"
gem "pg", "~> 1.5.8"
gem "sqlite3", "~> 2.1.0"
| ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/random_test.rb | test/random_test.rb | # frozen_string_literal: true
require "test_helper"
class RandomTest < ActiveSupport::TestCase
def test_that_hex_tokens_are_unique
tokens = Array.new(100) { Authlogic::Random.hex_token }
assert_equal tokens.size, tokens.uniq.size
end
def test_that_friendly_tokens_are_unique
tokens = Array.new(100) ... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/adapter_test.rb | test/adapter_test.rb | # frozen_string_literal: true
require "test_helper"
require "authlogic/controller_adapters/rails_adapter"
module Authlogic
module ControllerAdapters
class AbstractAdapterTest < ActiveSupport::TestCase
def test_controller
controller = Class.new(MockController) do
def controller.an_arbitra... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
require "coveralls"
require "simplecov"
require "simplecov-console"
Coveralls.wear!
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::Console,
# Want a nice code coverage website? Uncomment this next line!
SimpleCov::Formatter::HTMLFor... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/config_test.rb | test/config_test.rb | # frozen_string_literal: true
require "test_helper"
class ConfigTest < ActiveSupport::TestCase
def setup
@klass = Class.new {
extend Authlogic::Config
def self.foobar(value = nil)
rw_config(:foobar_field, value, "default_foobar")
end
}
@subklass = Class.new(@klass)
end
d... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/i18n_test.rb | test/i18n_test.rb | # frozen_string_literal: true
require "test_helper"
class I18nTest < ActiveSupport::TestCase
def test_uses_authlogic_as_scope_by_default
assert_equal :authlogic, Authlogic::I18n.scope
end
def test_can_set_scope
assert_nothing_raised { Authlogic::I18n.scope = %i[a b] }
assert_equal %i[a b], Authlogi... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/session_test.rb | test/session_test/session_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module SessionTest
class ConfigTest < ActiveSupport::TestCase
def test_session_key
UserSession.session_key = "my_session_key"
assert_equal "my_session_key", UserSession.session_key
UserSession.session_key "user... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/klass_test.rb | test/session_test/klass_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module KlassTest
class ConfigTest < ActiveSupport::TestCase
def test_authenticate_with
UserSession.authenticate_with = Employee
assert_equal "Employee", UserSession.klass_name
assert_equal Employee, UserSession.... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/unauthorized_record_test.rb | test/session_test/unauthorized_record_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
class UnauthorizedRecordTest < ActiveSupport::TestCase
def test_credentials
ben = users(:ben)
session = UserSession.new
session.credentials = [ben]
assert_equal ben, session.unauthorized_record
assert_equal({ un... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/cookies_test.rb | test/session_test/cookies_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module CookiesTest
class ConfigTest < ActiveSupport::TestCase
def test_cookie_key
UserSession.cookie_key = "my_cookie_key"
assert_equal "my_cookie_key", UserSession.cookie_key
UserSession.cookie_key "user_crede... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/http_auth_test.rb | test/session_test/http_auth_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
class HttpAuthTest < ActiveSupport::TestCase
class ConfigTest < ActiveSupport::TestCase
def test_allow_http_basic_auth
UserSession.allow_http_basic_auth = false
assert_equal false, UserSession.allow_http_basic_auth
... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/foundation_test.rb | test/session_test/foundation_test.rb | # frozen_string_literal: true
require "test_helper"
# We forbid the use of AC::Parameters, and we have a test to that effect, but we
# do not want a development dependency on `actionpack`, so we define it here.
module ActionController
class Parameters; end
end
module SessionTest
class FoundationTest < ActiveSupp... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/id_test.rb | test/session_test/id_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
class IdTest < ActiveSupport::TestCase
def test_credentials
session = UserSession.new
session.credentials = [:my_id]
assert_equal :my_id, session.id
end
def test_id
session = UserSession.new
session.id ... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/magic_states_test.rb | test/session_test/magic_states_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module SessionTest
class ConfigTest < ActiveSupport::TestCase
def test_disable_magic_states_config
UserSession.disable_magic_states = true
assert_equal true, UserSession.disable_magic_states
UserSession.disable... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/brute_force_protection_test.rb | test/session_test/brute_force_protection_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module BruteForceProtectionTest
class ConfigTest < ActiveSupport::TestCase
def test_consecutive_failed_logins_limit
UserSession.consecutive_failed_logins_limit = 10
assert_equal 10, UserSession.consecutive_failed_logins... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/magic_columns_test.rb | test/session_test/magic_columns_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module MagicColumnsTest
class ConfigTest < ActiveSupport::TestCase
def test_last_request_at_threshold_config
UserSession.last_request_at_threshold = 2.minutes
assert_equal 2.minutes, UserSession.last_request_at_threshol... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/persistence_test.rb | test/session_test/persistence_test.rb | # frozen_string_literal: true
require "test_helper"
require "authlogic/controller_adapters/rails_adapter"
module SessionTest
class PersistenceTest < ActiveSupport::TestCase
def test_find
aaron = users(:aaron)
refute UserSession.find
UserSession.allow_http_basic_auth = true
http_basic_aut... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/perishability_test.rb | test/session_test/perishability_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
class PerishabilityTest < ActiveSupport::TestCase
def test_after_save
ben = users(:ben)
old_perishable_token = ben.perishable_token
UserSession.create(ben)
assert_not_equal old_perishable_token, ben.perishable_token
... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/scopes_test.rb | test/session_test/scopes_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
class ScopesTest < ActiveSupport::TestCase
def test_scope_method
assert_nil Authlogic::Session::Base.scope
thread1 = Thread.new do
scope = { id: :scope1 }
Authlogic::Session::Base.send(:scope=, scope)
ass... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/active_record_trickery_test.rb | test/session_test/active_record_trickery_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module ActiveRecordTrickeryTest
class ClassMethodsTest < ActiveSupport::TestCase
# If test_human_name is executed after test_i18n_of_human_name the test will fail.
i_suck_and_my_tests_are_order_dependent!
def test_human_at... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/params_test.rb | test/session_test/params_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module ParamsTest
class ConfigTest < ActiveSupport::TestCase
def test_params_key
UserSession.params_key = "my_params_key"
assert_equal "my_params_key", UserSession.params_key
UserSession.params_key "user_creden... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/activation_test.rb | test/session_test/activation_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module ActivationTest
class ClassMethodsTest < ActiveSupport::TestCase
def test_activated
assert UserSession.activated?
Authlogic::Session::Base.controller = nil
refute UserSession.activated?
end
de... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/existence_test.rb | test/session_test/existence_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module ExistenceTest
class ClassMethodsTest < ActiveSupport::TestCase
def test_create_with_good_credentials
ben = users(:ben)
session = UserSession.create(login: ben.login, password: "benrocks")
refute session.n... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/timeout_test.rb | test/session_test/timeout_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module TimeoutTest
class ConfigTest < ActiveSupport::TestCase
def test_logout_on_timeout
UserSession.logout_on_timeout = true
assert UserSession.logout_on_timeout
UserSession.logout_on_timeout false
ref... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/credentials_test.rb | test/session_test/credentials_test.rb | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false | |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/validation_test.rb | test/session_test/validation_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
class ValidationTest < ActiveSupport::TestCase
def test_errors
session = UserSession.new
assert_kind_of ::ActiveModel::Errors, session.errors
end
def test_valid
session = UserSession.new
refute session.valid?... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/callbacks_test.rb | test/session_test/callbacks_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
class CallbacksTest < ActiveSupport::TestCase
def setup
WackyUserSession.reset_callbacks(:persist)
end
def test_no_callbacks
assert_equal [], WackyUserSession._persist_callbacks.map(&:filter)
session = WackyUserSes... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/session_test/password_test.rb | test/session_test/password_test.rb | # frozen_string_literal: true
require "test_helper"
module SessionTest
module PasswordTest
class ConfigTest < ActiveSupport::TestCase
def test_find_by_login_method_is_deprecated
expected_warning = Regexp.new(
Regexp.escape(::Authlogic::Session::Base::E_DPR_FIND_BY_LOGIN_METHOD)
)... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/crypto_provider_test/sha512_test.rb | test/crypto_provider_test/sha512_test.rb | # frozen_string_literal: true
require "test_helper"
module CryptoProviderTest
class Sha512Test < ActiveSupport::TestCase
def setup
@default_stretches = Authlogic::CryptoProviders::Sha512.stretches
end
def teardown
Authlogic::CryptoProviders::Sha512.stretches = @default_stretches
end
... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/crypto_provider_test/md5_test.rb | test/crypto_provider_test/md5_test.rb | # frozen_string_literal: true
require "test_helper"
module CryptoProviderTest
class MD5Test < ActiveSupport::TestCase
def setup
@default_stretches = Authlogic::CryptoProviders::MD5.stretches
end
def teardown
Authlogic::CryptoProviders::MD5.stretches = @default_stretches
end
def tes... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/crypto_provider_test/scrypt_test.rb | test/crypto_provider_test/scrypt_test.rb | # frozen_string_literal: true
require "test_helper"
module CryptoProviderTest
class SCryptTest < ActiveSupport::TestCase
def test_encrypt
assert Authlogic::CryptoProviders::SCrypt.encrypt("mypass")
end
def test_matches
hash = Authlogic::CryptoProviders::SCrypt.encrypt("mypass")
assert... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/crypto_provider_test/sha1_test.rb | test/crypto_provider_test/sha1_test.rb | # frozen_string_literal: true
require "test_helper"
module CryptoProviderTest
class Sha1Test < ActiveSupport::TestCase
def setup
@default_stretches = Authlogic::CryptoProviders::Sha1.stretches
end
def teardown
Authlogic::CryptoProviders::Sha1.stretches = @default_stretches
end
def ... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/crypto_provider_test/sha256_test.rb | test/crypto_provider_test/sha256_test.rb | # frozen_string_literal: true
require "test_helper"
module CryptoProviderTest
class Sha256Test < ActiveSupport::TestCase
def setup
@default_stretches = Authlogic::CryptoProviders::Sha256.stretches
end
def teardown
Authlogic::CryptoProviders::Sha256.stretches = @default_stretches
end
... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/crypto_provider_test/bcrypt_test.rb | test/crypto_provider_test/bcrypt_test.rb | # frozen_string_literal: true
require "test_helper"
module CryptoProviderTest
class BCryptTest < ActiveSupport::TestCase
def test_encrypt
assert Authlogic::CryptoProviders::BCrypt.encrypt("mypass")
end
def test_matches
hash = Authlogic::CryptoProviders::BCrypt.encrypt("mypass")
assert... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/crypto_provider_test/sha1/v2_test.rb | test/crypto_provider_test/sha1/v2_test.rb | # frozen_string_literal: true
require "test_helper"
module CryptoProviderTest
module VSHA1
class V2Test < ActiveSupport::TestCase
def setup
@default_stretches = Authlogic::CryptoProviders::Sha1::V2.stretches
end
def teardown
Authlogic::CryptoProviders::Sha1::V2.stretches = @de... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/crypto_provider_test/md5/v2_test.rb | test/crypto_provider_test/md5/v2_test.rb | # frozen_string_literal: true
require "test_helper"
module CryptoProviderTest
module MD5
class V2Test < ActiveSupport::TestCase
def setup
@default_stretches = Authlogic::CryptoProviders::MD5::V2.stretches
end
def teardown
Authlogic::CryptoProviders::MD5::V2.stretches = @defaul... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/crypto_provider_test/sha512/v2_test.rb | test/crypto_provider_test/sha512/v2_test.rb | # frozen_string_literal: true
require "test_helper"
module CryptoProviderTest
module SHA512
class V2Test < ActiveSupport::TestCase
def setup
@default_stretches = Authlogic::CryptoProviders::Sha512::V2.stretches
end
def teardown
Authlogic::CryptoProviders::Sha512::V2.stretches ... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/crypto_provider_test/sha256/v2_test.rb | test/crypto_provider_test/sha256/v2_test.rb | # frozen_string_literal: true
require "test_helper"
module CryptoProviderTest
module SHA256
class V2Test < ActiveSupport::TestCase
def setup
@default_stretches = Authlogic::CryptoProviders::Sha256::V2.stretches
end
def teardown
Authlogic::CryptoProviders::Sha256::V2.stretches ... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/acts_as_authentic_test/email_test.rb | test/acts_as_authentic_test/email_test.rb | # frozen_string_literal: true
require "test_helper"
module ActsAsAuthenticTest
class EmailTest < ActiveSupport::TestCase
def test_email_field_config
assert_equal :email, User.email_field
assert_equal :email, Employee.email_field
User.email_field = :nope
assert_equal :nope, User.email_fi... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
binarylogic/authlogic | https://github.com/binarylogic/authlogic/blob/77da613d09fe8e2be2c980d5a5d3c76109590edd/test/acts_as_authentic_test/perishable_token_test.rb | test/acts_as_authentic_test/perishable_token_test.rb | # frozen_string_literal: true
require "test_helper"
module ActsAsAuthenticTest
class PerishableTokenTest < ActiveSupport::TestCase
def test_perishable_token_valid_for_config
assert_equal 10.minutes.to_i, User.perishable_token_valid_for
assert_equal 10.minutes.to_i, Employee.perishable_token_valid_fo... | ruby | MIT | 77da613d09fe8e2be2c980d5a5d3c76109590edd | 2026-01-04T15:46:27.836259Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.