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 |
|---|---|---|---|---|---|---|---|---|
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/puzzles.rb | objects/puzzles.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'json'
require 'crack'
require 'nokogiri'
require_relative '../model/linear'
#
# Puzzles in XML/S3
# @todo #532:60min Implement a decorator for optional model configuration load.
# Let's implement a class that de... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/user_error.rb | objects/user_error.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# User Error
#
class UserError < StandardError
end
| ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/maybe_text.rb | objects/maybe_text.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Maybe text
#
class MaybeText
def initialize(text_if_present, maybe, exclude_if: false)
@maybe = maybe
@text = text_if_present
@exclude_if = exclude_if
end
def to_s
if @maybe.nil? || @maybe.empty?... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/jobs/job_detached.rb | objects/jobs/job_detached.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'fileutils'
#
# One job.
#
class JobDetached
def initialize(vcs, job)
@vcs = vcs
@job = job
end
def proceed
if ENV['RACK_ENV'] == 'test'
exclusive
else
Process.detach(fork { excl... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/jobs/job_emailed.rb | objects/jobs/job_emailed.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'mail'
#
# Job that emails if exception occurs.
#
class JobEmailed
def initialize(vcs, job)
@vcs = vcs
@job = job
end
def proceed
@job.proceed
rescue Exception => e
yaml = @vcs.repo.config... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/jobs/job_commiterrors.rb | objects/jobs/job_commiterrors.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require_relative '../truncated'
#
# Job that posts exceptions as commit messages.
#
class JobCommitErrors
def initialize(vcs, job)
@vcs = vcs
@job = job
end
def proceed
@job.proceed
rescue Exception =... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/jobs/job_recorded.rb | objects/jobs/job_recorded.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Job that records all requests.
#
class JobRecorded
def initialize(vcs, job)
@vcs = vcs
@job = job
end
def proceed
@job.proceed
open('/tmp/0pdd-done.txt', 'a+') do |f|
f.puts(@vcs.repo.name)... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/jobs/job_starred.rb | objects/jobs/job_starred.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Job that stars the repo.
# API: http://octokit.github.io/octokit.rb/method_list.html
#
class JobStarred
def initialize(vcs, job)
@vcs = vcs
@job = job
end
def proceed
output = @job.proceed
@vcs.s... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/jobs/job.rb | objects/jobs/job.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'mail'
require_relative '../diff'
require_relative '../puzzles'
#
# One job.
#
class Job
def initialize(vcs, storage, tickets)
@vcs = vcs
@storage = storage
@tickets = tickets
end
def proceed
... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/storage/cached_storage.rb | objects/storage/cached_storage.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# XML cached in a temporary file.
#
class CachedStorage
def initialize(origin, file)
@origin = origin
@file = file
end
def load
if File.exist?(@file)
begin
content = File.read(@file)
... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/storage/sync_storage.rb | objects/storage/sync_storage.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Thread-safe storage.
#
class SyncStorage
def initialize(origin)
@origin = origin
@mutex = Mutex.new
end
def load
@mutex.synchronize { @origin.load }
end
def save(xml)
@mutex.synchronize { @o... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/storage/versioned_storage.rb | objects/storage/versioned_storage.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Storage that adds version to the XML when it gets saved.
#
class VersionedStorage
def initialize(origin, version)
@origin = origin
@version = version
end
def load
xml = @origin.load
root = xml.xp... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/storage/s3.rb | objects/storage/s3.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'aws-sdk-s3'
require 'nokogiri'
require_relative '../../version'
#
# S3 storage.
#
class S3
def initialize(ocket, bucket, region, key, secret)
@object = Aws::S3::Resource.new(
region: region,
cre... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/storage/once_storage.rb | objects/storage/once_storage.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Saves only once, if the content wasn't really changed.
#
class OnceStorage
def initialize(origin)
@origin = origin
end
def load
@origin.load
end
def save(xml)
@origin.save(xml) if load.to_s != x... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/storage/safe_storage.rb | objects/storage/safe_storage.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'nokogiri'
#
# Safe, XSD validated, storage.
#
class SafeStorage
def initialize(origin)
@origin = origin
@xsd = Nokogiri::XML::Schema(File.read('assets/xsd/puzzles.xsd'))
end
def load
@origin.lo... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/storage/logged_storage.rb | objects/storage/logged_storage.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Storage that is logged.
#
class LoggedStorage
def initialize(origin, log)
@origin = origin
@log = log
end
def load
@origin.load
end
def save(xml)
@origin.save(xml)
@log.put(
"save-... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/storage/upgraded_storage.rb | objects/storage/upgraded_storage.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Storage that upgrades itself on load.
#
class UpgradedStorage
def initialize(origin, version)
@origin = origin
@version = version
end
def load
xml = @origin.load
if xml.xpath('/*/@version')[0] !=... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/tickets/tagged_tickets.rb | objects/tickets/tagged_tickets.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Tagged tickets.
#
class TaggedTickets
def initialize(vcs, tickets)
@vcs = vcs
@tickets = tickets
end
def notify(issue, message)
@tickets.notify(issue, message)
end
def submit(puzzle)
issue =... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/tickets/commit_tickets.rb | objects/tickets/commit_tickets.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Tickets that post into commits.
#
class CommitTickets
def initialize(vcs, tickets)
@vcs = vcs
@commit = vcs.repo.head_commit_hash
@tickets = tickets
end
def notify(issue, message)
@tickets.notify... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/tickets/emailed_tickets.rb | objects/tickets/emailed_tickets.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Tickets that email when submitted or closed.
#
class EmailedTickets
def initialize(vcs, tickets)
@vcs = vcs
@tickets = tickets
end
def notify(issue, message)
@tickets.notify(issue, message)
end
... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/tickets/tickets.rb | objects/tickets/tickets.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'haml'
require_relative '../truncated'
require_relative '../maybe_text'
#
# One ticket.
#
class Tickets
def initialize(vcs)
@vcs = vcs
end
def notify(issue, message)
@vcs.add_comment(
issue,
... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/tickets/sentry_tickets.rb | objects/tickets/sentry_tickets.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'mail'
require 'sentry-ruby'
require_relative '../user_error'
require_relative '../truncated'
#
# Tickets that report to Sentry.
#
class SentryTickets
def initialize(tickets)
@tickets = tickets
end
def ... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/tickets/logged_tickets.rb | objects/tickets/logged_tickets.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'cgi'
require_relative '../truncated'
require_relative '../user_error'
#
# Tickets that are logged.
#
class LoggedTickets
def initialize(vcs, log, tickets)
@vcs = vcs
@log = log
@tickets = tickets
... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/tickets/milestone_tickets.rb | objects/tickets/milestone_tickets.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Tickets that inherit milestones.
#
class MilestoneTickets
def initialize(vcs, tickets)
@vcs = vcs
@tickets = tickets
end
def notify(issue, message)
@tickets.notify(issue, message)
end
def submit... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/vcs/gitlab.rb | objects/vcs/gitlab.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'gitlab'
require_relative '../git_repo'
require_relative '../clients/gitlab'
#
# Gitlab repo
# API: https://github.com/NARKOZ/gitlab
#
class GitlabRepo
attr_reader :repo, :name
def initialize(client, json, co... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/vcs/github.rb | objects/vcs/github.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'octokit'
require_relative '../git_repo'
#
# Github VCS
#
class GithubRepo
attr_reader :repo, :name
def initialize(client, json, config = {})
@name = 'github'
@client = client
@config = config
... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/vcs/jira.rb | objects/vcs/jira.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'jira-ruby'
require_relative '../git_repo'
#
# Jira VCS
#
class JiraRepo
attr_reader :repo, :name
def initialize(client, json, config = {})
@name = 'JIRA'
@client = client
@config = config
@js... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/invitations/github_invitations.rb | objects/invitations/github_invitations.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
#
# Invitations in Github
#
class GithubInvitations
def initialize(github)
@github = github
end
def accept
@github.user_repository_invitations.each do |i|
break if @github.rate_limit.remaining < 1000
... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/invitations/github_organization_invitations.rb | objects/invitations/github_organization_invitations.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require_relative 'github_organization_invitation'
#
# Invitations to join Github organizations
#
class GithubOrganizationInvitations
def initialize(github)
@github = github
end
def all
@github.organization_... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/clients/gitlab.rb | objects/clients/gitlab.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'gitlab'
#
# Gitlab client
# API: https://github.com/NARKOZ/gitlab
#
class GitlabClient
def initialize(config = {})
@config = config
end
def client
if @config['testing']
require_relative '../.... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/clients/github.rb | objects/clients/github.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'octokit'
#
# Github client
# API: http://octokit.github.io/octokit.rb/method_list.html
#
class Github
def initialize(config = {})
@config = config
end
def client
if @config['testing']
require... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
yegor256/0pdd | https://github.com/yegor256/0pdd/blob/37c028933e9fdeee269d0579ff999ea13c3ea1dd/objects/clients/jira.rb | objects/clients/jira.rb | # SPDX-FileCopyrightText: Copyright (c) 2016-2026 Yegor Bugayenko
# SPDX-License-Identifier: MIT
require 'rubygems'
require 'jira-ruby'
#
# Jira client
# API: https://github.com/sumoheavy/jira-ruby
#
class JiraClient
def initialize(config = {})
@config = config
end
def client
if @config['testing']
... | ruby | MIT | 37c028933e9fdeee269d0579ff999ea13c3ea1dd | 2026-01-04T17:41:40.654421Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/app/controllers/metal_decorator.rb | app/controllers/metal_decorator.rb | # For the API
module MetalDecorator
def spree_current_user
@spree_current_user ||= if defined? env
env['warden'].user
else
request.env['warden'].user
end
end
end
ActionController::Metal.prep... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/app/controllers/spree/api/v2/storefront/passwords_controller.rb | app/controllers/spree/api/v2/storefront/passwords_controller.rb | module Spree
module Api
module V2
module Storefront
class PasswordsController < ::Spree::Api::V2::BaseController
include Spree::Core::ControllerHelpers::Store
def create
user = Spree.user_class.find_by(email: params[:user][:email])
if user&.send_reset_pa... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/app/controllers/spree/api/v2/storefront/account_confirmations_controller.rb | app/controllers/spree/api/v2/storefront/account_confirmations_controller.rb | module Spree
module Api
module V2
module Storefront
class AccountConfirmationsController < ::Spree::Api::V2::BaseController
def show
user = Spree.user_class.confirm_by_token(params[:id])
if user.errors.empty?
render json: { data: { state: user.respon... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/app/models/spree/user.rb | app/models/spree/user.rb | module Spree
class User < Spree::Base
include UserAddress
include UserMethods
include UserPaymentSource
include Metadata if defined?(Spree::Metadata)
devise :database_authenticatable if Spree::Auth::Config[:database_authenticatable]
devise :recoverable if Spree::Auth::Config[:recoverable]
... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/db/seeds.rb | db/seeds.rb | # Loads seed data out of default dir
default_path = File.join(File.dirname(__FILE__), 'default')
Rake::Task['db:load_dir'].reenable
Rake::Task['db:load_dir'].invoke(default_path)
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/db/default/users.rb | db/default/users.rb | require 'highline/import'
# see last line where we create an admin if there is none, asking for email and password
def prompt_for_admin_password
if ENV['ADMIN_PASSWORD']
password = ENV['ADMIN_PASSWORD'].dup
say "Admin Password #{password}"
else
password = ask('Password [spree123]: ') do |q|
q.ech... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/db/migrate/20101214150824_convert_user_remember_field.rb | db/migrate/20101214150824_convert_user_remember_field.rb | class ConvertUserRememberField < SpreeExtension::Migration[4.2]
def up
remove_column :spree_users, :remember_created_at
add_column :spree_users, :remember_created_at, :datetime
end
def down
remove_column :spree_users, :remember_created_at
add_column :spree_users, :remember_created_at, :string
e... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb | db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb | class AddResetPasswordSentAtToSpreeUsers < SpreeExtension::Migration[4.2]
def change
Spree.user_class.reset_column_information
unless Spree.user_class.column_names.include?("reset_password_sent_at")
add_column :spree_users, :reset_password_sent_at, :datetime
end
end
end
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/db/migrate/20141002154641_add_confirmable_to_users.rb | db/migrate/20141002154641_add_confirmable_to_users.rb | class AddConfirmableToUsers < SpreeExtension::Migration[4.2]
def change
add_column :spree_users, :confirmation_token, :string
add_column :spree_users, :confirmed_at, :datetime
add_column :spree_users, :confirmation_sent_at, :datetime
end
end
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/db/migrate/20101026184950_rename_columns_for_devise.rb | db/migrate/20101026184950_rename_columns_for_devise.rb | class RenameColumnsForDevise < SpreeExtension::Migration[4.2]
def up
return if column_exists?(:spree_users, :password_salt)
rename_column :spree_users, :crypted_password, :encrypted_password
rename_column :spree_users, :salt, :password_salt
rename_column :spree_users, :remember_token_expires_at, :reme... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/db/migrate/20210728103922_change_type_of_ship_address_id_and_bill_address_id_for_spree_users.rb | db/migrate/20210728103922_change_type_of_ship_address_id_and_bill_address_id_for_spree_users.rb | class ChangeTypeOfShipAddressIdAndBillAddressIdForSpreeUsers < ActiveRecord::Migration[4.2]
def change
change_table(:spree_users) do |t|
t.change :ship_address_id, :bigint
t.change :bill_address_id, :bigint
end
end
end
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/db/migrate/20150416152553_add_missing_indices_on_user.rb | db/migrate/20150416152553_add_missing_indices_on_user.rb | class AddMissingIndicesOnUser < SpreeExtension::Migration[4.2]
def change
unless index_exists?(:spree_users, :bill_address_id)
add_index :spree_users, :bill_address_id
end
unless index_exists?(:spree_users, :ship_address_id)
add_index :spree_users, :ship_address_id
end
end
end
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/db/migrate/20140904000425_add_deleted_at_to_users.rb | db/migrate/20140904000425_add_deleted_at_to_users.rb | class AddDeletedAtToUsers < SpreeExtension::Migration[4.2]
def change
add_column :spree_users, :deleted_at, :datetime
add_index :spree_users, :deleted_at
end
end
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/db/migrate/20120605211305_make_users_email_index_unique.rb | db/migrate/20120605211305_make_users_email_index_unique.rb | class MakeUsersEmailIndexUnique < SpreeExtension::Migration[4.2]
def up
add_index "spree_users", ["email"], name: "email_idx_unique", unique: true
end
def down
remove_index "spree_users", name: "email_idx_unique"
end
end
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/db/migrate/20101026184949_create_users.rb | db/migrate/20101026184949_create_users.rb | class CreateUsers < SpreeExtension::Migration[4.2]
def up
unless data_source_exists?("spree_users")
create_table "spree_users", force: true do |t|
t.string "crypted_password", limit: 128
t.string "salt", limit: 128
t.string "email"
t.string... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/spec_helper.rb | spec/spec_helper.rb | # Configure Rails Environment
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../dummy/config/environment.rb', __FILE__)
require 'spree_dev_tools/rspec/spec_helper'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[File.join(File.dirname(__FILE_... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/support/confirm_helpers.rb | spec/support/confirm_helpers.rb | RSpec.configure do |config|
config.around do |example|
if example.metadata.key?(:confirmable)
old_setting = Spree::Auth::Config.confirmable
old_user = Spree::User
begin
example.run
ensure
Spree.const_set('User', old_user)
Spree::Auth::Config.confirmable = old_setti... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/support/configuration_helpers.rb | spec/support/configuration_helpers.rb | module ConfigurationHelpers
def allow_bypass_sign_in
Spree::Auth::Config.set(:signout_after_password_change, false)
end
end
RSpec.configure do |config|
config.include ConfigurationHelpers
end
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/support/ability.rb | spec/support/ability.rb | RSpec.configure do |config|
config.after do
Spree::Ability.abilities.delete(AbilityDecorator) if Spree::Ability.abilities.include?(AbilityDecorator)
end
end
if defined? CanCan::Ability
class AbilityDecorator
include CanCan::Ability
def initialize(_user)
cannot :manage, Spree::Order
end
e... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/support/email.rb | spec/support/email.rb | RSpec.configure do |config|
config.before do
ActionMailer::Base.deliveries.clear
end
end
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/requests/spree/api/v2/storefront/account_confirmation_spec.rb | spec/requests/spree/api/v2/storefront/account_confirmation_spec.rb | require 'spec_helper'
describe 'Storefront API v2 Account Confirmation spec', type: :request do
describe 'account_confirmations#show' do
before do
Spree::User.stub(:confirm_by_token, confirmation_token: confirmation_token).and_return user
get "/api/v2/storefront/account_confirmations/#{confirmation_... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/requests/spree/api/v2/storefront/account_spec.rb | spec/requests/spree/api/v2/storefront/account_spec.rb | require 'spec_helper'
describe 'Storefront API v2 Account spec', type: :request do
describe 'account#create' do
before { post '/api/v2/storefront/account', params: params }
context 'valid user params' do
let(:params) do
{
"user": {
"email": "hello@example.com",
... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/requests/spree/frontend/user_update_spec.rb | spec/requests/spree/frontend/user_update_spec.rb | # frozen_string_literal: true
RSpec.feature 'User update', type: :request do
context 'CSRF protection' do
%i[exception reset_session null_session].each do |strategy|
# Completely clean the configuration of forgery protection for the
# controller and reset it after the expectations. However, besides `... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/factories/confirmed_user.rb | spec/factories/confirmed_user.rb | FactoryBot.define do
factory :confirmed_user, parent: :user do
confirmed_at { Time.now }
confirmation_sent_at { Time.now }
confirmation_token "12345"
end
end
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/controllers/spree/checkout_controller_spec.rb | spec/controllers/spree/checkout_controller_spec.rb | RSpec.describe Spree::CheckoutController, type: :controller do
let(:order) { create(:order_with_totals, email: nil, user: nil) }
let(:user) { build(:user, spree_api_key: 'fake') }
let(:token) { 'some_token' }
before do
allow(controller).to receive(:current_order) { order }
allow(order).to receive(:con... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/controllers/spree/user_registrations_controller_spec.rb | spec/controllers/spree/user_registrations_controller_spec.rb | RSpec.describe Spree::UserRegistrationsController, type: :controller do
before { @request.env['devise.mapping'] = Devise.mappings[:spree_user] }
context '#create' do
before { allow(controller).to receive(:after_sign_up_path_for).and_return(spree.account_path) }
it 'redirects to account_path' do
post... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/controllers/spree/user_passwords_controller_spec.rb | spec/controllers/spree/user_passwords_controller_spec.rb | RSpec.describe Spree::UserPasswordsController, type: :controller do
let(:token) { 'some_token' }
before { @request.env['devise.mapping'] = Devise.mappings[:spree_user] }
describe 'GET edit' do
context 'when the user token has not been specified' do
it 'redirects to the new session path' do
get... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/controllers/spree/users_controller_spec.rb | spec/controllers/spree/users_controller_spec.rb | RSpec.describe Spree::UsersController, type: :controller do
let(:admin_user) { create(:user) }
let(:user) { create(:user) }
let(:role) { create(:role) }
before do
allow(controller).to receive(:spree_current_user) { user }
Spree::Store.default.update(default_locale: 'en', supported_locales: 'en,fr')
... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/controllers/spree/user_sessions_controller_spec.rb | spec/controllers/spree/user_sessions_controller_spec.rb | RSpec.describe Spree::UserSessionsController, type: :controller do
let(:user) { create(:user) }
before { @request.env['devise.mapping'] = Devise.mappings[:spree_user] }
context "#create" do
context "using correct login information" do
if Gem.loaded_specs['spree_core'].version >= Gem::Version.create('3... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/controllers/spree/products_controller_spec.rb | spec/controllers/spree/products_controller_spec.rb | RSpec.describe Spree::ProductsController, type: :controller do
let!(:product) { create(:product, available_on: 1.year.from_now) }
let!(:user) { build_stubbed(:user, spree_api_key: 'fake') }
subject(:request) { get :show, params: { id: product.to_param }}
before do
allow(controller).to receive(:before_save... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/controllers/spree/admin/orders_controller_spec.rb | spec/controllers/spree/admin/orders_controller_spec.rb | module Spree
module Admin
RSpec.describe OrdersController, type: :controller do
stub_authorization!
context '#authorize_admin' do
it 'grants access to users with an admin role' do
get :new
expect(response).to redirect_to spree.cart_admin_order_path(Order.last)
end
... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/controllers/spree/admin/user_sessions_controller_spec.rb | spec/controllers/spree/admin/user_sessions_controller_spec.rb | RSpec.describe Spree::Admin::UserSessionsController, type: :controller do
before { @request.env['devise.mapping'] = Devise.mappings[:spree_user] }
describe '#authorization_failure' do
subject { get :authorization_failure }
context 'user signed in' do
before { allow(controller).to receive(:spree_curr... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/controllers/spree/api/v2/storefront/passwords_controller_spec.rb | spec/controllers/spree/api/v2/storefront/passwords_controller_spec.rb | RSpec.describe Spree::Api::V2::Storefront::PasswordsController, type: :controller do
let(:user) { create(:user) }
let(:password) { 'new_password' }
let(:store) { create(:store) }
describe 'POST create' do
before { post :create, params: params }
context 'when the user email has not been specified' do
... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/models/order_spec.rb | spec/models/order_spec.rb | RSpec.describe Spree::Order, type: :model do
let(:order) { described_class.new }
context '#associate_user!' do
let(:user) { build_stubbed(:user, email: 'spree@example.com') }
before { allow(order).to receive(:save!) { true } }
it 'associates the order with the specified user' do
order.associate_... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/models/user_spec.rb | spec/models/user_spec.rb | RSpec.describe Spree::User, type: :model do
before(:all) { Spree::Role.create name: 'admin' }
let!(:store) { create(:store) }
it '#admin?' do
expect(create(:admin_user).admin?).to be true
expect(create(:user).admin?).to be false
end
it 'generates the reset password token' do
user = build(:user)
... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/confirmation_spec.rb | spec/features/confirmation_spec.rb | require 'spec_helper'
RSpec.feature 'Confirmation', type: :feature, confirmable: true do
before do
expect(Spree::UserMailer).to receive(:confirmation_instructions).with(anything, anything, { current_store_id: Spree::Store.default.id }).and_return(double(deliver: true))
end
background do
ActionMailer::Ba... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/password_reset_spec.rb | spec/features/password_reset_spec.rb | RSpec.feature 'Reset Password', type: :feature do
background do
ActionMailer::Base.default_url_options[:host] = 'http://example.com'
end
scenario 'allow a user to supply an email for the password reset' do
user = create(:user, email: 'foobar@example.com', password: 'secret', password_confirmation: 'secre... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/order_spec.rb | spec/features/order_spec.rb | RSpec.feature 'Orders', :js, type: :feature do
scenario 'allow a user to view their cart at any time' do
visit spree.cart_path
expect(page).to have_text 'Your cart is empty'
end
# regression test for spree/spree#1687
scenario 'merge incomplete orders from different sessions' do
ror_mug = create(:pr... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/admin_permissions_spec.rb | spec/features/admin_permissions_spec.rb | RSpec.feature 'Admin Permissions', type: :feature do
context 'orders' do
background do
user = create(:admin_user, email: 'admin@person.com', password: 'password', password_confirmation: 'password')
Spree::Ability.register_ability(AbilityDecorator)
visit spree.login_path
fill_in 'Email', w... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/checkout_spec.rb | spec/features/checkout_spec.rb | RSpec.feature 'Checkout', :js, type: :feature do
given!(:country) { create(:country, name: 'United States', states_required: true) }
given!(:state) { create(:state, name: 'Maryland', country: country) }
given!(:shipping_method) do
shipping_method = create(:shipping_method)
calculator = Spree::Calculator... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/account_spec.rb | spec/features/account_spec.rb | RSpec.feature 'Accounts', type: :feature do
describe 'editing', js: true do
before do
allow_bypass_sign_in
end
scenario 'can edit an admin user' do
user = create(:admin_user, email: 'admin@person.com', password: 'password', password_confirmation: 'password')
visit spree.login_path
... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/sign_up_spec.rb | spec/features/sign_up_spec.rb | RSpec.feature 'Sign Up', type: :feature do
context 'with valid data' do
scenario 'create a new user' do
visit spree.signup_path
fill_in 'Email', with: 'email@person.com'
fill_in 'Password', with: 'password'
fill_in 'Password Confirmation', with: 'password'
click_button 'Sign Up'
... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/change_email_spec.rb | spec/features/change_email_spec.rb | RSpec.feature 'Change email', type: :feature do
background do
allow_bypass_sign_in
user = create(:user, email: 'old@spree.com', password: 'secret')
log_in(email: user.email, password: 'secret')
visit spree.edit_account_path
end
scenario 'work with correct password', js: true do
fill_in 'user... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/sign_in_spec.rb | spec/features/sign_in_spec.rb | RSpec.feature 'Sign In', type: :feature do
background do
@user = create(:user, email: 'email@person.com', password: 'secret', password_confirmation: 'secret')
visit spree.login_path
end
scenario 'ask user to sign in' do
visit spree.admin_path
expect(page).not_to have_text 'Authorization Failure'
... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/sign_out_spec.rb | spec/features/sign_out_spec.rb | RSpec.feature 'Sign Out', type: :feature, js: true do
given!(:user) do
create(:user,
email: 'email@person.com',
password: 'secret',
password_confirmation: 'secret')
end
background do
log_in(email: user.email, password: user.password)
end
scenario 'allow a signed in user... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/admin/products_spec.rb | spec/features/admin/products_spec.rb | RSpec.feature 'Admin products', type: :feature do
context 'as anonymous user' do
# Regression test for #1250
scenario 'redirects to login page when attempting to access product listing' do
expect { visit spree.admin_products_path }.not_to raise_error
end
end
end
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/admin/password_reset_spec.rb | spec/features/admin/password_reset_spec.rb | RSpec.feature 'Admin - Reset Password', type: :feature do
background do
ActionMailer::Base.default_url_options[:host] = 'http://example.com'
end
scenario 'allows a user to supply an email for the password reset' do
user = create(:user, email: 'foobar@example.com', password: 'secret', password_confirmatio... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/admin/orders_spec.rb | spec/features/admin/orders_spec.rb | RSpec.feature 'Admin orders', type: :feature do
background do
user = create(:admin_user)
log_in email: user.email, password: user.password
end
# Regression #203
scenario 'can list orders' do
expect { visit spree.admin_orders_path }.not_to raise_error
end
# Regression #203
scenario 'can new o... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/admin/sign_in_spec.rb | spec/features/admin/sign_in_spec.rb | RSpec.feature 'Admin - Sign In', type: :feature do
background do
@user = create(:user, email: 'email@person.com')
visit spree.admin_login_path
end
scenario 'asks user to sign in' do
visit spree.admin_path
expect(page).not_to have_text 'Authorization Failure'
end
scenario 'lets a user sign in... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/features/admin/sign_out_spec.rb | spec/features/admin/sign_out_spec.rb | RSpec.feature 'Admin - Sign Out', type: :feature, js: true do
given!(:user) do
create :user, email: 'email@person.com'
end
background do
visit spree.admin_login_path
fill_in 'Email', with: user.email
fill_in 'Password', with: 'secret'
# Regression test for #1257
check 'Remember me'
cli... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/spec/mailers/user_mailer_spec.rb | spec/mailers/user_mailer_spec.rb | RSpec.describe Spree::UserMailer, type: :mailer do
let(:user) { create(:user) }
let(:store) { Spree::Store.default }
describe '#reset_password_instructions' do
describe 'message contents' do
before do
@message = described_class.reset_password_instructions(user, 'token goes here', { current_stor... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/spree_auth_devise.rb | lib/spree_auth_devise.rb | require 'spree_core'
require 'spree/auth/devise'
require 'spree/authentication_helpers'
require 'spree_extension'
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/spree/authentication_helpers.rb | lib/spree/authentication_helpers.rb | module Spree
module AuthenticationHelpers
def self.included(receiver)
receiver.send :helper_method, :spree_current_user
receiver.send :helper_method, :spree_login_path
receiver.send :helper_method, :spree_signup_path
receiver.send :helper_method, :spree_logout_path
end
def spree_c... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/spree/auth.rb | lib/spree/auth.rb | # This file is required by the dummy app's config/environment
require 'spree_auth_devise'
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/spree/auth/version.rb | lib/spree/auth/version.rb | module Spree
module Auth
VERSION = '4.6.3'.freeze
def gem_version
Gem::Version.new(VERSION)
end
end
end
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/spree/auth/devise.rb | lib/spree/auth/devise.rb | require 'spree/core'
require 'devise'
require 'devise-encryptable'
require 'cancan'
Devise.secret_key = SecureRandom.hex(50)
module Spree
module Auth
mattr_accessor :default_secret_key
def self.config
yield(Spree::Auth::Config)
end
end
end
Spree::Auth.default_secret_key = Devise.secret_key
re... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/spree/auth/configuration.rb | lib/spree/auth/configuration.rb | module Spree
module Auth
class Configuration
attr_accessor :registration_step,
:signout_after_password_change,
:confirmable,
:database_authenticatable,
:recoverable,
:registerable,
:valida... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/spree/auth/engine.rb | lib/spree/auth/engine.rb | require 'devise'
require 'devise-encryptable'
require_relative 'configuration'
module Spree
module Auth
class Engine < Rails::Engine
isolate_namespace Spree
engine_name 'spree_auth'
initializer "spree.auth.environment", before: :load_config_initializers do |_app|
Spree::Auth::Config =... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/spree/testing_support/checkout_helpers.rb | lib/spree/testing_support/checkout_helpers.rb | module Spree
module TestingSupport
module CheckoutHelpers
def fill_in_address
address = 'order_bill_address_attributes'
fill_in "#{address}_firstname", with: 'Ryan'
fill_in "#{address}_lastname", with: 'Bigg'
fill_in "#{address}_address1", with: '143 Swan Street'
fill... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/spree/testing_support/auth_helpers.rb | lib/spree/testing_support/auth_helpers.rb | module Spree
module TestingSupport
module AuthHelpers
def login_button
Spree.version.to_f == 4.1 ? Spree.t(:log_in) : Spree.t(:login)
end
def logout_button
Spree.version.to_f == 4.1 ? Spree.t('nav_bar.log_out') : Spree.t(:logout).upcase
end
def log_in(email:, passwo... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/backend/spree/auth/admin/base_controller_decorator.rb | lib/controllers/backend/spree/auth/admin/base_controller_decorator.rb | module Spree::Auth::Admin::BaseControllerDecorator
# Redirect as appropriate when an access request fails. The default action is to redirect to the login screen.
# Override this method in your controllers if you want to have special behavior in case the user is not authorized
# to access the requested action. F... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/backend/spree/auth/admin/orders_controller_decorator.rb | lib/controllers/backend/spree/auth/admin/orders_controller_decorator.rb | module Spree::Auth::Admin::OrdersControllerDecorator
def self.prepended(base)
base.before_action :check_authorization
end
private
def load_order_action
[:edit, :update, :cancel, :resume, :approve, :resend, :open_adjustments, :close_adjustments, :cart]
end
def check_authorization
action = par... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/backend/spree/auth/admin/resource_controller_decorator.rb | lib/controllers/backend/spree/auth/admin/resource_controller_decorator.rb | module Spree::Auth::Admin::ResourceControllerDecorator
def self.prepended(base)
base.rescue_from CanCan::AccessDenied, with: :unauthorized
end
end
Spree::Admin::ResourceController.prepend(Spree::Auth::Admin::ResourceControllerDecorator)
| ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/backend/spree/auth/admin/orders/customer_details_controller_decorator.rb | lib/controllers/backend/spree/auth/admin/orders/customer_details_controller_decorator.rb | module Spree::Auth::Admin::Orders::CustomerDetailsControllerDecorator
def self.prepended(base)
base.before_action :check_authorization
end
private
def check_authorization
load_order
session[:access_token] ||= params[:token]
resource = @order
action = params[:action].to_sym
action = :... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/backend/spree/admin/user_sessions_controller.rb | lib/controllers/backend/spree/admin/user_sessions_controller.rb | class Spree::Admin::UserSessionsController < Devise::SessionsController
helper 'spree/base'
include Spree::Core::ControllerHelpers::Auth
include Spree::Core::ControllerHelpers::Store
helper 'spree/admin/navigation'
layout :resolve_layout
def create
authenticate_spree_user!
if spree_user_signed_i... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/backend/spree/admin/user_passwords_controller.rb | lib/controllers/backend/spree/admin/user_passwords_controller.rb | class Spree::Admin::UserPasswordsController < Devise::PasswordsController
helper 'spree/base'
include Spree::Core::ControllerHelpers::Auth
include Spree::Core::ControllerHelpers::Store
helper 'spree/admin/navigation'
layout 'spree/layouts/login'
# Overridden due to bug in Devise.
# respond_with resou... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/frontend/spree/user_registrations_controller.rb | lib/controllers/frontend/spree/user_registrations_controller.rb | class Spree::UserRegistrationsController < Devise::RegistrationsController
helper 'spree/base'
include Spree::Core::ControllerHelpers::Auth
include Spree::Core::ControllerHelpers::Common
include Spree::Core::ControllerHelpers::Order
include Spree::Core::ControllerHelpers::Store
include SpreeI18n::Controll... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
spree/spree_auth_devise | https://github.com/spree/spree_auth_devise/blob/b49629c477ed2a9997733f061c26379e09901131/lib/controllers/frontend/spree/user_sessions_controller.rb | lib/controllers/frontend/spree/user_sessions_controller.rb | class Spree::UserSessionsController < Devise::SessionsController
helper 'spree/base'
include Spree::Core::ControllerHelpers::Auth
include Spree::Core::ControllerHelpers::Common
include Spree::Core::ControllerHelpers::Order
include Spree::Core::ControllerHelpers::Store
include SpreeI18n::ControllerLocaleHe... | ruby | BSD-3-Clause | b49629c477ed2a9997733f061c26379e09901131 | 2026-01-04T17:41:41.379260Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.