source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
heartcombo/devise
https://github.com/heartcombo/devise
test/devise_test.rb
Ruby
mit
24,345
main
3,507
# frozen_string_literal: true require 'test_helper' module Devise def self.yield_and_restore @@warden_configured = nil c, b = @@warden_config, @@warden_config_blocks yield ensure @@warden_config, @@warden_config_blocks = c, b end end class DeviseTest < ActiveSupport::TestCase test 'bcrypt on ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/test_helper.rb
Ruby
mit
24,345
main
1,042
# frozen_string_literal: true ENV["RAILS_ENV"] = "test" DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym $:.unshift File.dirname(__FILE__) puts "\n==> Devise.orm = #{DEVISE_ORM.inspect}" require "rails_app/config/environment" require "rails/test_help" require "orm/#{DEVISE_ORM}" I18n.load_path.concat Dir["...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_test.rb
Ruby
mit
24,345
main
529
# frozen_string_literal: true require 'test_helper' class RailsTest < ActiveSupport::TestCase test 'correct initializer position' do initializer = Devise::Engine.initializers.detect { |i| i.name == 'devise.omniauth' } assert_equal :load_config_initializers, initializer.after assert_equal :build_middlewa...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/test_models.rb
Ruby
mit
24,345
main
864
# frozen_string_literal: true class Configurable < User devise :database_authenticatable, :confirmable, :rememberable, :timeoutable, :lockable, stretches: 15, pepper: 'abcdef', allow_unconfirmed_access_for: 5.days, remember_for: 7.days, timeout_in: 15.minutes, unlock_in: 10.days end class WithVali...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/delegator_test.rb
Ruby
mit
24,345
main
661
# frozen_string_literal: true require 'test_helper' class DelegatorTest < ActiveSupport::TestCase def delegator Devise::Delegator.new end test 'failure_app returns default failure app if no warden options in env' do assert_equal Devise::FailureApp, delegator.failure_app({}) end test 'failure_app r...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/parameter_sanitizer_test.rb
Ruby
mit
24,345
main
3,248
# frozen_string_literal: true require 'test_helper' require 'devise/parameter_sanitizer' class ParameterSanitizerTest < ActiveSupport::TestCase def sanitizer(params) params = ActionController::Parameters.new(params) Devise::ParameterSanitizer.new(User, :user, params) end test 'permits the default param...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models_test.rb
Ruby
mit
24,345
main
4,781
# frozen_string_literal: true require 'test_helper' require 'test_models' class ActiveRecordTest < ActiveSupport::TestCase def include_module?(klass, mod) klass.devise_modules.include?(mod) && klass.included_modules.include?(Devise::Models::const_get(mod.to_s.classify)) end def assert_include_modules...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/failure_app_test.rb
Ruby
mit
24,345
main
18,646
# frozen_string_literal: true require 'test_helper' require 'ostruct' class FailureTest < ActiveSupport::TestCase class RootFailureApp < Devise::FailureApp def fake_app Object.new end end class FailureWithSubdomain < RootFailureApp routes = ActionDispatch::Routing::RouteSet.new routes.dr...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/mapping_test.rb
Ruby
mit
24,345
main
4,762
# frozen_string_literal: true require 'test_helper' class FakeRequest < Struct.new(:path_info, :params) end class MappingTest < ActiveSupport::TestCase def fake_request(path, params = {}) FakeRequest.new(path, params) end test 'store options' do mapping = Devise.mappings[:user] assert_equal User, ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/routes_test.rb
Ruby
mit
24,345
main
12,371
# frozen_string_literal: true require 'test_helper' ExpectedRoutingError = Minitest::Assertion class DefaultRoutingTest < ActionController::TestCase test 'map new user session' do assert_recognizes({controller: 'devise/sessions', action: 'new'}, {path: 'users/sign_in', method: :get}) assert_named_route "/u...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/support/integration.rb
Ruby
mit
24,345
main
2,635
# frozen_string_literal: true require 'action_dispatch/testing/integration' class ActionDispatch::IntegrationTest def warden request.env['warden'] end def create_user(options = {}) @user ||= begin user = User.create!( username: 'usertest', email: options[:email] || 'user@test.com'...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/support/helpers.rb
Ruby
mit
24,345
main
2,447
# frozen_string_literal: true require 'active_support/test_case' class ActiveSupport::TestCase def setup_mailer ActionMailer::Base.deliveries = [] end def store_translations(locale, translations, &block) # Calling 'available_locales' before storing the translations to ensure # that the I18n backend...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/support/assertions.rb
Ruby
mit
24,345
main
839
# frozen_string_literal: true require 'active_support/test_case' class ActiveSupport::TestCase def assert_blank(assertion) assert assertion.blank? end def assert_present(assertion) assert assertion.present? end def assert_email_sent(address = nil, &block) assert_difference('ActionMailer::Base....
github
heartcombo/devise
https://github.com/heartcombo/devise
test/support/webrat/matchers.rb
Ruby
mit
24,345
main
511
# Monkey patch for Nokogiri changes - https://github.com/sparklemotion/nokogiri/issues/2469 module Webrat module Matchers class HaveSelector def query Nokogiri::CSS::Parser.new.parse(@expected.to_s).map do |ast| if ::Gem::Version.new(Nokogiri::VERSION) < ::Gem::Version.new('1.17.2') ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/support/webrat/integrations/rails.rb
Ruby
mit
24,345
main
968
# frozen_string_literal: true require 'webrat/core/elements/form' require 'action_dispatch/testing/integration' module Webrat Form.class_eval do def self.parse_rails_request_params(params) Rack::Utils.parse_nested_query(params) end end module Logging # Avoid RAILS_DEFAULT_LOGGER deprecation w...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/support/action_controller/record_identifier.rb
Ruby
mit
24,345
main
331
# frozen_string_literal: true # Since webrat uses ActionController::RecordIdentifier class that was moved to # ActionView namespace in Rails 4.1+ unless defined?(ActionController::RecordIdentifier) require 'action_view/record_identifier' module ActionController RecordIdentifier = ActionView::RecordIdentifier...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/helpers/devise_helper_test.rb
Ruby
mit
24,345
main
1,311
# frozen_string_literal: true require 'test_helper' class DeviseHelperTest < Devise::IntegrationTest setup do model_labels = { models: { user: "the user" } } translations = { errors: { messages: { not_saved: { one: "Can't save %{resource} because of 1 error", other: "Can't save %{resou...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/recoverable_test.rb
Ruby
mit
24,345
main
13,413
# frozen_string_literal: true require 'test_helper' class PasswordTest < Devise::IntegrationTest def visit_new_password_path visit new_user_session_path click_link 'Forgot your password?' end def request_forgot_password(&block) visit_new_password_path assert_response :success assert_not wa...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/omniauthable_test.rb
Ruby
mit
24,345
main
5,403
# frozen_string_literal: true require 'test_helper' class OmniauthableIntegrationTest < Devise::IntegrationTest FACEBOOK_INFO = { "id" => '12345', "link" => 'http://facebook.com/josevalim', "email" => 'user@example.com', "first_name" => 'Jose', "last_name" => 'Valim', "website" => 'http://b...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/confirmable_test.rb
Ruby
mit
24,345
main
14,960
# frozen_string_literal: true require 'test_helper' class ConfirmationTest < Devise::IntegrationTest def visit_user_confirmation_with_token(confirmation_token) visit user_confirmation_path(confirmation_token: confirmation_token) end def resend_confirmation user = create_user(confirm: false) Action...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/registerable_test.rb
Ruby
mit
24,345
main
14,494
# frozen_string_literal: true require 'test_helper' class RegistrationTest < Devise::IntegrationTest test 'a guest admin should be able to sign in successfully' do get new_admin_session_path click_link 'Sign up' assert_template 'registrations/new' fill_in 'email', with: 'new_user@test.com' fi...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/authenticatable_test.rb
Ruby
mit
24,345
main
21,740
# frozen_string_literal: true require 'test_helper' class AuthenticationSanityTest < Devise::IntegrationTest test 'sign in should not run model validations' do sign_in_as_user assert_not User.validations_performed end test 'home should be accessible without sign in' do visit '/' assert_respons...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/lockable_test.rb
Ruby
mit
24,345
main
7,647
# frozen_string_literal: true require 'test_helper' class LockTest < Devise::IntegrationTest def visit_user_unlock_with_token(unlock_token) visit user_unlock_path(unlock_token: unlock_token) end def send_unlock_request user = create_user(locked: true) ActionMailer::Base.deliveries.clear visit...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/database_authenticatable_test.rb
Ruby
mit
24,345
main
3,282
# frozen_string_literal: true require 'test_helper' class DatabaseAuthenticationTest < Devise::IntegrationTest test 'sign in with email of different case should succeed when email is in the list of case insensitive keys' do create_user(email: 'Foo@Bar.com') sign_in_as_user do fill_in 'email', with: '...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/http_authenticatable_test.rb
Ruby
mit
24,345
main
4,124
# frozen_string_literal: true require 'test_helper' class HttpAuthenticationTest < Devise::IntegrationTest test 'sign in with HTTP should not run model validations' do sign_in_as_new_user_with_http assert_not User.validations_performed end test 'handles unverified requests gets rid of caches but conti...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/rememberable_test.rb
Ruby
mit
24,345
main
6,466
# frozen_string_literal: true require 'test_helper' class RememberMeTest < Devise::IntegrationTest def create_user_and_remember(add_to_token = '') user = create_user user.remember_me! raw_cookie = User.serialize_into_cookie(user).tap { |a| a[1] << add_to_token } cookies['remember_user_token'] = gene...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/mounted_engine_test.rb
Ruby
mit
24,345
main
1,780
# frozen_string_literal: true require 'test_helper' module MyMountableEngine class Engine < ::Rails::Engine isolate_namespace MyMountableEngine end class TestsController < ActionController::Base def index render plain: 'Root test successful' end def inner_route render plain: 'Inner r...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/timeoutable_test.rb
Ruby
mit
24,345
main
5,254
# frozen_string_literal: true require 'test_helper' class SessionTimeoutTest < Devise::IntegrationTest def last_request_at @controller.user_session['last_request_at'] end test 'set last request at in user session after each request' do sign_in_as_user assert_not_nil last_request_at @controlle...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/integration/trackable_test.rb
Ruby
mit
24,345
main
2,553
# frozen_string_literal: true require 'test_helper' class TrackableHooksTest < Devise::IntegrationTest test "trackable should not run model validations" do sign_in_as_user assert_not User.validations_performed end test "current and last sign in timestamps are updated on each sign in" do user = cre...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/Rakefile
Ruby
mit
24,345
main
249
# Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) Rails.application.load_tasks
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/active_record/user.rb
Ruby
mit
24,345
main
395
# frozen_string_literal: true require 'shared_user' class User < ActiveRecord::Base include Shim include SharedUser validates :sign_in_count, presence: true cattr_accessor :validations_performed after_validation :after_validation_callback def after_validation_callback # used to check in our test i...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/active_record/user_with_validations.rb
Ruby
mit
24,345
main
206
# frozen_string_literal: true require 'shared_user' class UserWithValidations < ActiveRecord::Base self.table_name = 'users' include Shim include SharedUser validates :email, presence: true end
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/controllers/application_with_fake_engine.rb
Ruby
mit
24,345
main
624
# frozen_string_literal: true class ApplicationWithFakeEngine < ApplicationController private helper_method :fake_engine def fake_engine @fake_engine ||= FakeEngine.new end end class FakeEngine def user_on_engine_confirmation_path '/user_on_engine/confirmation' end def new_user_on_engine_sessi...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/controllers/application_controller.rb
Ruby
mit
24,345
main
683
# frozen_string_literal: true # Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. class ApplicationController < ActionController::Base protect_from_forgery around_action :set_locale before_action :current_user, ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/controllers/home_controller.rb
Ruby
mit
24,345
main
355
# frozen_string_literal: true class HomeController < ApplicationController def index end def private end def user_dashboard end def admin_dashboard end def join end def set session["devise.foo_bar"] = "something" head :ok end def unauthenticated render body: "unauthenticated...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/controllers/users_controller.rb
Ruby
mit
24,345
main
784
# frozen_string_literal: true class UsersController < ApplicationController prepend_before_action :current_user, only: :exhibit before_action :authenticate_user!, except: [:accept, :exhibit] clear_respond_to respond_to :html, :json def index user_session[:cart] = "Cart" respond_with(current_user) ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/controllers/custom/registrations_controller.rb
Ruby
mit
24,345
main
553
# frozen_string_literal: true class Custom::RegistrationsController < Devise::RegistrationsController def new super do |resource| @new_block_called = true end end def create super do |resource| @create_block_called = true end end def update super do |resource| @update_...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/controllers/users/omniauth_callbacks_controller.rb
Ruby
mit
24,345
main
492
# frozen_string_literal: true class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def facebook data = request.respond_to?(:get_header) ? request.get_header("omniauth.auth") : request.env["omniauth.auth"] session["devise.facebook_data"] = data["extra"]["user_hash"] render json: ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/mongoid/user_without_email.rb
Ruby
mit
24,345
main
983
# frozen_string_literal: true require "shared_user_without_email" class UserWithoutEmail include Mongoid::Document include Shim include SharedUserWithoutEmail field :username, type: String field :facebook_token, type: String ## Database authenticatable field :email, type: String, default: "" field :...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/mongoid/user_with_validations.rb
Ruby
mit
24,345
main
996
# frozen_string_literal: true require "shared_user" class UserWithValidations include Mongoid::Document include Shim include SharedUser field :username, type: String field :facebook_token, type: String ## Database authenticatable field :email, type: String, default: "" field :encrypted_password, typ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/mongoid/user_on_main_app.rb
Ruby
mit
24,345
main
1,198
# frozen_string_literal: true require 'shared_user_without_omniauth' class UserOnMainApp include Mongoid::Document include Shim include SharedUserWithoutOmniauth field :username, type: String field :facebook_token, type: String ## Database authenticatable field :email, type: String, default: "" fiel...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/mongoid/user.rb
Ruby
mit
24,345
main
1,427
# frozen_string_literal: true require 'shared_user' class User include Mongoid::Document include Shim include SharedUser field :username, type: String field :facebook_token, type: String ## Database authenticatable field :email, type: String, default: "" field :encrypted_password, type:...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/mongoid/admin.rb
Ruby
mit
24,345
main
733
# frozen_string_literal: true require 'shared_admin' class Admin include Mongoid::Document include Shim include SharedAdmin ## Database authenticatable field :email, type: String field :encrypted_password, type: String ## Recoverable field :reset_password_token, type: String field :...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/mongoid/user_on_engine.rb
Ruby
mit
24,345
main
1,197
# frozen_string_literal: true require 'shared_user_without_omniauth' class UserOnEngine include Mongoid::Document include Shim include SharedUserWithoutOmniauth field :username, type: String field :facebook_token, type: String ## Database authenticatable field :email, type: String, default: "" field...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/app/mongoid/shim.rb
Ruby
mit
24,345
main
483
# frozen_string_literal: true module Shim extend ::ActiveSupport::Concern included do include ::Mongoid::Timestamps field :created_at, type: DateTime end module ClassMethods def order(attribute) asc(attribute) end def find_by_email(email) find_by(email: email) end end ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/lib/shared_user.rb
Ruby
mit
24,345
main
775
# frozen_string_literal: true module SharedUser extend ActiveSupport::Concern included do devise :database_authenticatable, :confirmable, :lockable, :recoverable, :registerable, :rememberable, :timeoutable, :trackable, :validatable, :omniauthable, password_length: 7..72, recon...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/lib/shared_user_without_omniauth.rb
Ruby
mit
24,345
main
365
# frozen_string_literal: true module SharedUserWithoutOmniauth extend ActiveSupport::Concern included do devise :database_authenticatable, :confirmable, :lockable, :recoverable, :registerable, :rememberable, :timeoutable, :trackable, :validatable, reconfirmable: false end def raw_confirmation...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/lib/shared_user_without_email.rb
Ruby
mit
24,345
main
999
# frozen_string_literal: true module SharedUserWithoutEmail extend ActiveSupport::Concern included do # NOTE: This is missing :validatable and :confirmable, as they both require # an email field at the moment. It is also missing :omniauthable because that # adds unnecessary complexity to the setup ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/lib/shared_admin.rb
Ruby
mit
24,345
main
591
# frozen_string_literal: true module SharedAdmin extend ActiveSupport::Concern included do devise :database_authenticatable, :registerable, :timeoutable, :recoverable, :lockable, :confirmable, unlock_strategy: :time, lock_strategy: :none, allow_unconfirmed_access_for: 2.weeks,...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/config/application.rb
Ruby
mit
24,345
main
1,527
# frozen_string_literal: true require File.expand_path('../boot', __FILE__) require "logger" require "action_controller/railtie" require "action_mailer/railtie" require "rails/test_unit/railtie" Bundler.require :default, DEVISE_ORM begin require "#{DEVISE_ORM}/railtie" rescue LoadError end require "devise" modu...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/config/boot.rb
Ruby
mit
24,345
main
633
# frozen_string_literal: true unless defined?(DEVISE_ORM) DEVISE_ORM = (ENV["DEVISE_ORM"] || :active_record).to_sym end module Devise module Test # Detection for minor differences between Rails versions in tests. def self.rails71_and_up? !rails70? && Rails::VERSION::MAJOR >= 7 end def self...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/config/routes.rb
Ruby
mit
24,345
main
4,043
# frozen_string_literal: true Rails.application.routes.draw do # Resources for testing resources :users, only: [:index] do member do get :expire get :accept get :edit_form put :update_form end authenticate do post :exhibit, on: :member end end resources :admins, ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/config/initializers/backtrace_silencers.rb
Ruby
mit
24,345
main
433
# frozen_string_literal: true # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/config/initializers/devise.rb
Ruby
mit
24,345
main
9,262
# frozen_string_literal: true require "omniauth-facebook" require "omniauth-openid" # Assuming you have not yet modified this file, each configuration option below # is set to its default value. Note that some are commented out while others # are not: uncommented lines are intended to protect your configuration from ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/config/initializers/secret_token.rb
Ruby
mit
24,345
main
222
# frozen_string_literal: true config = Rails.application.config config.secret_key_base = 'd588e99efff13a86461fd6ab82327823ad2f8feb5dc217ce652cdd9f0dfc5eb4b5a62a92d24d2574d7d51dfb1ea8dd453ea54e00cf672159a13104a135422a10'
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/config/environments/test.rb
Ruby
mit
24,345
main
1,764
# frozen_string_literal: true RailsApp::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database i...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/config/environments/production.rb
Ruby
mit
24,345
main
3,293
# frozen_string_literal: true RailsApp::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memor...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/config/environments/development.rb
Ruby
mit
24,345
main
1,158
# frozen_string_literal: true RailsApp::Application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/db/schema.rb
Ruby
mit
24,345
main
2,150
# encoding: UTF-8 # frozen_string_literal: true # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb defi...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/rails_app/db/migrate/20100401102949_create_tables.rb
Ruby
mit
24,345
main
1,927
# frozen_string_literal: true class CreateTables < ActiveRecord::Migration[5.0] def self.up create_table :users do |t| t.string :username t.string :facebook_token ## Database authenticatable t.string :email, null: false, default: "" t.string :encrypted_password, null: ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/generators/mongoid_generator_test.rb
Ruby
mit
24,345
main
653
# frozen_string_literal: true require "test_helper" if DEVISE_ORM == :mongoid require "generators/mongoid/devise_generator" class MongoidGeneratorTest < Rails::Generators::TestCase tests Mongoid::Generators::DeviseGenerator destination File.expand_path("../../tmp", __FILE__) setup :prepare_destinatio...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/generators/devise_generator_test.rb
Ruby
mit
24,345
main
1,123
# frozen_string_literal: true require 'test_helper' require "generators/devise/devise_generator" class DeviseGeneratorTest < Rails::Generators::TestCase tests Devise::Generators::DeviseGenerator destination File.expand_path("../../tmp", __FILE__) setup do prepare_destination copy_routes end test ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/generators/controllers_generator_test.rb
Ruby
mit
24,345
main
1,912
# frozen_string_literal: true require "test_helper" class ControllersGeneratorTest < Rails::Generators::TestCase tests Devise::Generators::ControllersGenerator destination File.expand_path("../../tmp", __FILE__) setup :prepare_destination test "Assert no controllers are created with no params" do capture...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/generators/views_generator_test.rb
Ruby
mit
24,345
main
4,892
# frozen_string_literal: true require "test_helper" class ViewsGeneratorTest < Rails::Generators::TestCase tests Devise::Generators::ViewsGenerator destination File.expand_path("../../tmp", __FILE__) setup :prepare_destination test "Assert all views are properly created with no params" do run_generator ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/generators/install_generator_test.rb
Ruby
mit
24,345
main
1,055
# frozen_string_literal: true require "test_helper" class InstallGeneratorTest < Rails::Generators::TestCase tests Devise::Generators::InstallGenerator destination File.expand_path("../../tmp", __FILE__) setup :prepare_destination test "assert all files are properly created" do run_generator(["--orm=acti...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/generators/active_record_generator_test.rb
Ruby
mit
24,345
main
4,206
# frozen_string_literal: true require "test_helper" if DEVISE_ORM == :active_record require "generators/active_record/devise_generator" class ActiveRecordGeneratorTest < Rails::Generators::TestCase tests ActiveRecord::Generators::DeviseGenerator destination File.expand_path("../../tmp", __FILE__) set...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/orm/mongoid.rb
Ruby
mit
24,345
main
275
# frozen_string_literal: true require 'mongoid/version' Mongoid.configure do |config| config.load!('test/support/mongoid.yml') config.use_utc = true config.include_root_in_json = true end class ActiveSupport::TestCase setup do Mongoid::Config.purge! end end
github
heartcombo/devise
https://github.com/heartcombo/devise
test/orm/active_record.rb
Ruby
mit
24,345
main
541
# frozen_string_literal: true ActiveRecord::Migration.verbose = false ActiveRecord::Base.logger = Logger.new(nil) ActiveRecord::Base.include_root_in_json = true migrate_path = File.expand_path("../../rails_app/db/migrate/", __FILE__) if Devise::Test.rails71_and_up? ActiveRecord::MigrationContext.new(migrate_path).m...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/controllers/sessions_controller_test.rb
Ruby
mit
24,345
main
3,339
# frozen_string_literal: true require 'test_helper' class SessionsControllerTest < Devise::ControllerTestCase tests Devise::SessionsController include Devise::Test::ControllerHelpers test "#create doesn't raise unpermitted params when sign in fails" do begin subscriber = ActiveSupport::Notifications....
github
heartcombo/devise
https://github.com/heartcombo/devise
test/controllers/helpers_test.rb
Ruby
mit
24,345
main
12,828
# frozen_string_literal: true require 'test_helper' require 'ostruct' class ControllerAuthenticatableTest < Devise::ControllerTestCase tests ApplicationController def setup @mock_warden = OpenStruct.new @controller.request.env['warden'] = @mock_warden end test 'provide access to warden instance' do ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/controllers/internal_helpers_test.rb
Ruby
mit
24,345
main
4,738
# frozen_string_literal: true require 'test_helper' class MyController < DeviseController end class HelpersTest < Devise::ControllerTestCase tests MyController def setup @mock_warden = OpenStruct.new @controller.request.env['warden'] = @mock_warden @controller.request.env['devise.mapping'] = Devise....
github
heartcombo/devise
https://github.com/heartcombo/devise
test/controllers/url_helpers_test.rb
Ruby
mit
24,345
main
2,401
# frozen_string_literal: true require 'test_helper' class RoutesTest < Devise::ControllerTestCase tests ApplicationController def assert_path_and_url(name, prepend_path = nil) @request.path = '/users/session' prepend_path = "#{prepend_path}_" if prepend_path # Resource param assert_equal @contro...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/controllers/inherited_controller_i18n_messages_test.rb
Ruby
mit
24,345
main
1,318
# frozen_string_literal: true require 'test_helper' class SessionsInheritedController < Devise::SessionsController def test_i18n_scope set_flash_message(:notice, :signed_in) end end class AnotherInheritedController < SessionsInheritedController protected def translation_scope 'another' end end cl...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/controllers/load_hooks_controller_test.rb
Ruby
mit
24,345
main
537
# frozen_string_literal: true require 'test_helper' class LoadHooksControllerTest < Devise::ControllerTestCase setup do ActiveSupport.on_load(:devise_controller) do define_method :defined_by_load_hook do puts 'I am defined dynamically by activesupport load hook' end end end teardown...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/controllers/passwords_controller_test.rb
Ruby
mit
24,345
main
1,250
# frozen_string_literal: true require 'test_helper' class PasswordsControllerTest < Devise::ControllerTestCase tests Devise::PasswordsController include Devise::Test::ControllerHelpers setup do request.env["devise.mapping"] = Devise.mappings[:user] @user = create_user.tap(&:confirm) @raw = @user.s...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/controllers/custom_strategy_test.rb
Ruby
mit
24,345
main
1,885
# frozen_string_literal: true require 'test_helper' require 'ostruct' require 'warden/strategies/base' require 'devise/test/controller_helpers' class CustomStrategyController < ActionController::Base def new warden.authenticate!(:custom_strategy) end end # These tests are to prove that a warden strategy can ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/controllers/custom_registrations_controller_test.rb
Ruby
mit
24,345
main
1,499
# frozen_string_literal: true require 'test_helper' class CustomRegistrationsControllerTest < Devise::ControllerTestCase tests Custom::RegistrationsController include Devise::Test::ControllerHelpers setup do request.env["devise.mapping"] = Devise.mappings[:user] @password = 'password' @user = crea...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/controllers/helper_methods_test.rb
Ruby
mit
24,345
main
636
# frozen_string_literal: true require 'test_helper' class ApiController < ActionController::Metal include Devise::Controllers::Helpers end class HelperMethodsTest < Devise::ControllerTestCase tests ApiController test 'includes Devise::Controllers::Helpers' do assert_includes @controller.class.ancestors, D...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/rememberable_test.rb
Ruby
mit
24,345
main
5,739
# frozen_string_literal: true require 'test_helper' class RememberableTest < ActiveSupport::TestCase def resource_class User end def create_resource create_user end test 'remember_me should not generate a new token if using salt' do user = create_user user.expects(:valid?).never user.r...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/confirmable_test.rb
Ruby
mit
24,345
main
19,372
# frozen_string_literal: true require 'test_helper' class ConfirmableTest < ActiveSupport::TestCase def setup setup_mailer end test 'should set callbacks to send the mail' do if DEVISE_ORM == :active_record defined_callbacks = User._commit_callbacks.map(&:filter) assert_includes defined_ca...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/recoverable_test.rb
Ruby
mit
24,345
main
8,978
# frozen_string_literal: true require 'test_helper' class RecoverableTest < ActiveSupport::TestCase def setup setup_mailer end test 'should not generate reset password token after creating a record' do assert_nil new_user.reset_password_token end test 'should never generate the same reset passwor...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/trackable_test.rb
Ruby
mit
24,345
main
2,201
# frozen_string_literal: true require 'test_helper' class TrackableTest < ActiveSupport::TestCase test 'required_fields should contain the fields that Devise uses' do assert_equal [ :current_sign_in_at, :current_sign_in_ip, :last_sign_in_at, :last_sign_in_ip, :sign_in_count ], ...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/serializable_test.rb
Ruby
mit
24,345
main
1,447
# frozen_string_literal: true require 'test_helper' class SerializableTest < ActiveSupport::TestCase setup do @user = create_user end test 'should not include unsafe keys on JSON' do keys = from_json().keys.select{ |key| !key.include?("id") } assert_equal %w(created_at email facebook_token updated_...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/registerable_test.rb
Ruby
mit
24,345
main
256
# frozen_string_literal: true require 'test_helper' class RegisterableTest < ActiveSupport::TestCase test 'required_fields should contain the fields that Devise uses' do assert_equal [], Devise::Models::Registerable.required_fields(User) end end
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/database_authenticatable_test.rb
Ruby
mit
24,345
main
11,113
# frozen_string_literal: true require 'test_helper' require 'test_models' require 'digest/sha1' class DatabaseAuthenticatableTest < ActiveSupport::TestCase def setup setup_mailer end test 'should downcase case insensitive keys when saving' do # case_insensitive_keys is set to :email by default. ema...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/authenticatable_test.rb
Ruby
mit
24,345
main
2,262
# frozen_string_literal: true require 'test_helper' class AuthenticatableTest < ActiveSupport::TestCase test 'required_fields should be an empty array' do assert_equal [], Devise::Models::Validatable.required_fields(User) end test 'find_first_by_auth_conditions allows custom filtering parameters' do us...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/lockable_test.rb
Ruby
mit
24,345
main
12,400
# frozen_string_literal: true require 'test_helper' class LockableTest < ActiveSupport::TestCase def setup setup_mailer end test "should respect maximum attempts configuration" do user = create_user user.confirm swap Devise, maximum_attempts: 2 do 2.times { user.valid_for_authentication?{...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/timeoutable_test.rb
Ruby
mit
24,345
main
1,482
# frozen_string_literal: true require 'test_helper' class TimeoutableTest < ActiveSupport::TestCase test 'should be expired' do assert new_user.timedout?(31.minutes.ago) end test 'should not be expired' do assert_not new_user.timedout?(29.minutes.ago) end test 'should not be expired when params i...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/omniauthable_test.rb
Ruby
mit
24,345
main
256
# frozen_string_literal: true require 'test_helper' class OmniauthableTest < ActiveSupport::TestCase test 'required_fields should contain the fields that Devise uses' do assert_equal [], Devise::Models::Omniauthable.required_fields(User) end end
github
heartcombo/devise
https://github.com/heartcombo/devise
test/models/validatable_test.rb
Ruby
mit
24,345
main
4,161
# encoding: UTF-8 # frozen_string_literal: true require 'test_helper' class ValidatableTest < ActiveSupport::TestCase test 'should require email to be set' do user = new_user(email: nil) assert user.invalid? assert user.errors[:email] assert user.errors.added?(:email, :blank) end test 'should r...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/omniauth/url_helpers_test.rb
Ruby
mit
24,345
main
1,807
# frozen_string_literal: true require 'test_helper' class OmniAuthRoutesTest < ActionController::TestCase tests ApplicationController def assert_path(action, provider, with_param = true) # Resource param assert_equal @controller.send(action, :user, provider), @controller.send("user_#{pro...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/omniauth/config_test.rb
Ruby
mit
24,345
main
1,890
# frozen_string_literal: true require 'test_helper' class OmniAuthConfigTest < ActiveSupport::TestCase class MyStrategy include OmniAuth::Strategy end test 'strategy_name returns provider if no options given' do config = Devise::OmniAuth::Config.new :facebook, [{}] assert_equal :facebook, config.st...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/test/controller_helpers_test.rb
Ruby
mit
24,345
main
5,260
# frozen_string_literal: true require 'test_helper' class TestControllerHelpersTest < Devise::ControllerTestCase tests UsersController include Devise::Test::ControllerHelpers test "redirects if attempting to access a page unauthenticated" do get :index assert_redirected_to new_user_session_path ass...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/test/integration_helpers_test.rb
Ruby
mit
24,345
main
714
# frozen_string_literal: true require 'test_helper' class TestIntegrationsHelpersTest < Devise::IntegrationTest include Devise::Test::IntegrationHelpers test '#sign_in signs in the resource directly' do sign_in(create_user) visit '/' assert warden.authenticated?(:user) end test '#sign_outs sign...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/mailers/unlock_instructions_test.rb
Ruby
mit
24,345
main
2,478
# frozen_string_literal: true require 'test_helper' class UnlockInstructionsTest < ActionMailer::TestCase def setup setup_mailer Devise.mailer = 'Devise::Mailer' Devise.mailer_sender = 'test@example.com' end def teardown Devise.mailer = 'Devise::Mailer' Devise.mailer_sender = 'please-chang...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/mailers/email_changed_test.rb
Ruby
mit
24,345
main
3,511
# frozen_string_literal: true require 'test_helper' class EmailChangedTest < ActionMailer::TestCase def setup setup_mailer Devise.mailer = 'Devise::Mailer' Devise.mailer_sender = 'test@example.com' Devise.send_email_changed_notification = true end def teardown Devise.mailer = 'Devise::Maile...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/mailers/mailer_test.rb
Ruby
mit
24,345
main
1,301
# frozen_string_literal: true require "test_helper" class MailerTest < ActionMailer::TestCase test "pass given block to #mail call" do class TestMailer < Devise::Mailer def confirmation_instructions(record, token, opts = {}) @token = token devise_mail(record, :confirmation_instructions, op...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/mailers/confirmation_instructions_test.rb
Ruby
mit
24,345
main
3,245
# frozen_string_literal: true require 'test_helper' class ConfirmationInstructionsTest < ActionMailer::TestCase def setup setup_mailer Devise.mailer = 'Devise::Mailer' Devise.mailer_sender = 'test@example.com' end def teardown Devise.mailer = 'Devise::Mailer' Devise.mailer_sender = 'please...
github
heartcombo/devise
https://github.com/heartcombo/devise
test/mailers/reset_password_instructions_test.rb
Ruby
mit
24,345
main
2,742
# frozen_string_literal: true require 'test_helper' class ResetPasswordInstructionsTest < ActionMailer::TestCase def setup setup_mailer Devise.mailer = 'Devise::Mailer' Devise.mailer_sender = 'test@example.com' end def teardown Devise.mailer = 'Devise::Mailer' Devise.mailer_sender = 'please...
github
heartcombo/devise
https://github.com/heartcombo/devise
guides/bug_report_templates/integration_test.rb
Ruby
mit
24,345
main
2,243
# frozen_string_literal: true begin require 'bundler/inline' rescue LoadError => e $stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' raise e end gemfile(true) do source 'https://rubygems.org' # Activate the gem you are reporting the issue against. gem 'rails', '~> 4.2.0'...