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 |
|---|---|---|---|---|---|---|---|---|
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/importmap.rails_admin.rb | spec/dummy_app/config/importmap.rails_admin.rb | # frozen_string_literal: true
# Pin npm packages by running ./bin/importmap
pin 'rails_admin', preload: true
pin 'rails_admin/src/rails_admin/base', to: 'rails_admin/base.js'
pin '@hotwired/turbo', to: 'https://ga.jspm.io/npm:@hotwired/turbo@7.1.0/dist/turbo.es2017-esm.js'
pin '@hotwired/turbo-rails', to: 'https://ga... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/boot.rb | spec/dummy_app/config/boot.rb | # frozen_string_literal: true
CI_ORM = (ENV['CI_ORM'] || :active_record).to_sym unless defined?(CI_ORM)
CI_TARGET_ORMS = %i[active_record mongoid].freeze
CI_ASSET = (ENV['CI_ASSET'] || :sprockets).to_sym unless defined?(CI_ASSET)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/filter_parameter_logging.rb | spec/dummy_app/config/initializers/filter_parameter_logging.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
| ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/application_controller_renderer.rb | spec/dummy_app/config/initializers/application_controller_renderer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
| ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/session_store.rb | spec/dummy_app/config/initializers/session_store.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: '_dummy_app_session'
| ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/devise.rb | spec/dummy_app/config/initializers/devise.rb | # frozen_string_literal: true
# Use this hook to configure devise mailer, warden hooks and so forth.
# Many of these configuration options can be set straight in your model.
Devise.setup do |config|
# The secret key used by Devise. Devise uses this key to generate
# random tokens. Changing this key will render inv... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/mongoid.rb | spec/dummy_app/config/initializers/mongoid.rb | # frozen_string_literal: true
if CI_ORM == :mongoid
filename =
if Mongoid.respond_to?(:belongs_to_required_by_default=)
'mongoid6.yml'
else
'mongoid5.yml'
end
::Mongoid.load!(Rails.root.join('config', filename))
end
| ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/wrap_parameters.rb | spec/dummy_app/config/initializers/wrap_parameters.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_con... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/inflections.rb | spec/dummy_app/config/initializers/inflections.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflec... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/session_patch.rb | spec/dummy_app/config/initializers/session_patch.rb | # frozen_string_literal: true
require 'action_dispatch/middleware/session/abstract_store'
# When ORM was switched, but another ORM's model class still exists in session
# (Devise saves User model to session), ActionDispatch raises ActionDispatch::Session::SessionRestoreError
# and app can't be started unless you dele... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/rails_admin.rb | spec/dummy_app/config/initializers/rails_admin.rb | # frozen_string_literal: true
RailsAdmin.config do |c|
c.asset_source = CI_ASSET
c.model Team do
include_all_fields
field :color, :hidden
end
if Rails.env.production?
# Live demo configuration
c.main_app_name = ['RailsAdmin', 'Live Demo']
c.included_models = %w[Comment Division Draft Fan F... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/cookies_serializer.rb | spec/dummy_app/config/initializers/cookies_serializer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# This is a new Rails 5.0 default, so introduced as a config to ensure apps made with earlier versions of Rails aren't affected when upgrading.
Rails.application.config.action_dispatch.cookies_serializer = :json
| ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/shrine.rb | spec/dummy_app/config/initializers/shrine.rb | # frozen_string_literal: true
require 'shrine'
require 'shrine/storage/memory'
Shrine.storages = {
cache: Shrine::Storage::Memory.new,
store: Shrine::Storage::Memory.new,
}
| ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/assets.rb | spec/dummy_app/config/initializers/assets.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0' if Rails.application.config.respond_to?(:assets)
# Add additional assets to the asset load path
# Rail... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/dragonfly.rb | spec/dummy_app/config/initializers/dragonfly.rb | # frozen_string_literal: true
require 'dragonfly'
# Logger
Dragonfly.logger = Rails.logger
# Configure
Dragonfly.app.configure do
plugin :imagemagick
protect_from_dos_attacks true
secret '904547b2be647f0e11a76933b3220d6bd2fb83f380ac760125e4daa3b9504b4e'
url_format '/media/:job/:name'
datastore(:file,
... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/backtrace_silencers.rb | spec/dummy_app/config/initializers/backtrace_silencers.rb | # 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... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/mime_types.rb | spec/dummy_app/config/initializers/mime_types.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/secret_token.rb | spec/dummy_app/config/initializers/secret_token.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words ... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/initializers/cors.rb | spec/dummy_app/config/initializers/cors.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Avoid CORS issues when API is called from the frontend app.
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
# Read more: https://github.com/cyu/rack-cors
# Rails.application.confi... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/environments/test.rb | spec/dummy_app/config/environments/test.rb | # frozen_string_literal: true
DummyApp::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... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/environments/development.rb | spec/dummy_app/config/environments/development.rb | # frozen_string_literal: true
DummyApp::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... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/dummy_app/config/environments/production.rb | spec/dummy_app/config/environments/production.rb | # frozen_string_literal: true
DummyApp::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... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/support/fixtures.rb | spec/support/fixtures.rb | # frozen_string_literal: true
def file_path(*paths)
File.expand_path(File.join(File.dirname(__FILE__), '../fixtures', *paths))
end
| ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/support/cuprite_logger.rb | spec/support/cuprite_logger.rb | # frozen_string_literal: true
class ConsoleLogger
def self.puts(message)
warn(message) unless message.start_with?(' ◀', "\n\n▶")
end
end
| ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/support/fakeio.rb | spec/support/fakeio.rb | # frozen_string_literal: true
require 'forwardable'
require 'stringio'
class FakeIO
attr_reader :original_filename, :content_type
def initialize(content, filename: nil, content_type: nil)
@io = StringIO.new(content)
@original_filename = filename
@content_type = content_type
end
extend Forwardabl... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/rails_admin_spec.rb | spec/integration/rails_admin_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin, type: :request do
subject { page }
before do
RailsAdmin::Config.authenticate_with { warden.authenticate! scope: :user }
RailsAdmin::Config.current_user_method(&:current_user)
login_as User.create(
email: 'username@ex... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/authorization/cancancan_spec.rb | spec/integration/authorization/cancancan_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'RailsAdmin CanCanCan Authorization', type: :request do
class Ability
include CanCan::Ability
def initialize(user)
can :access, :rails_admin if user.roles.include? :admin
can :read, :dashboard
if user.roles.include? :test_e... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/authorization/pundit_spec.rb | spec/integration/authorization/pundit_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'RailsAdmin Pundit Authorization', type: :request do
subject { page }
before do
RailsAdmin.config do |c|
c.authorize_with(:pundit)
c.authenticate_with { warden.authenticate! scope: :user }
c.current_user_method(&:current_use... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/authentication/devise_spec.rb | spec/integration/authentication/devise_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'RailsAdmin Devise Authentication', type: :request do
subject { page }
let!(:user) { FactoryBot.create :user }
before do
RailsAdmin.config do |config|
config.authenticate_with do
warden.authenticate! scope: :user
end
... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/auditing/paper_trail_spec.rb | spec/integration/auditing/paper_trail_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'RailsAdmin PaperTrail auditing', active_record: true do
before(:each) do
RailsAdmin.config do |config|
config.audit_with :paper_trail
end
end
shared_examples :paper_on_object_creation do
describe 'on object creation', type: :... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/show_spec.rb | spec/integration/actions/show_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Show action', type: :request do
subject { page }
let(:team) { FactoryBot.create :team }
describe 'page' do
it 'has History, Edit, Delete, Details and attributes' do
@player = FactoryBot.create :player
visit show_path(model_name... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/export_spec.rb | spec/integration/actions/export_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'csv'
RSpec.describe 'Export action', type: :request do
subject { page }
let!(:player) { FactoryBot.create(:player) }
it 'exports to CSV' do
visit export_path(model_name: 'player')
click_button 'Export to csv'
is_expected.to have_content ... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/bulk_delete_spec.rb | spec/integration/actions/bulk_delete_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'BulkDelete action', type: :request do
subject { page }
describe 'confirmation page' do
before do
@players = FactoryBot.create_list(:player, 2)
end
it 'shows names of to-be-deleted players' do
post(bulk_action_path(bulk_a... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/new_spec.rb | spec/integration/actions/new_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'New action', type: :request do
subject { page }
describe 'page' do
before do
visit new_path(model_name: 'player')
end
it 'shows "New Model"' do
is_expected.to have_content('New Player')
end
it 'shows required fi... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/delete_spec.rb | spec/integration/actions/delete_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Delete action', type: :request do
subject { page }
it 'shows "Delete model"' do
@draft = FactoryBot.create :draft
@player = @draft.player
@comment = @player.comments.create
visit delete_path(model_name: 'player', id: @player.id)
... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/history_show_spec.rb | spec/integration/actions/history_show_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'HistoryShow action', type: :request, active_record: true do
let(:user) { FactoryBot.create :user }
let(:paper_trail_test) { FactoryBot.create :paper_trail_test }
before(:each) do
RailsAdmin.config do |config|
config.audit_with :paper_... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/history_index_spec.rb | spec/integration/actions/history_index_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'HistoryIndex action', type: :request, active_record: true do
subject { page }
let(:user) { FactoryBot.create :user }
let(:paper_trail_test) { FactoryBot.create :paper_trail_test }
before(:each) do
RailsAdmin.config do |config|
conf... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/dashboard_spec.rb | spec/integration/actions/dashboard_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Dashboard action', type: :request do
subject { page }
it 'shows statistics by default' do
allow(RailsAdmin.config(Player).abstract_model).to receive(:count).and_return(0)
expect(RailsAdmin.config(Player).abstract_model).to receive(:count... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/base_spec.rb | spec/integration/actions/base_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Base action', type: :request do
subject { page }
describe '#enabled?' do
it 'prevents the access to unauthorized actions' do
RailsAdmin.config do |config|
config.actions do
index do
except %w[FieldTest]
... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/edit_spec.rb | spec/integration/actions/edit_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Edit action', type: :request do
subject { page }
describe 'page' do
before do
@player = FactoryBot.create :player
visit edit_path(model_name: 'player', id: @player.id)
end
it 'shows "Edit model"' do
is_expected.to ... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/show_in_app_spec.rb | spec/integration/actions/show_in_app_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'ShowInApp action', type: :request do
subject { page }
describe 'link' do
let!(:player) { FactoryBot.create :player }
it 'has the data-turbo: false attribute' do
visit index_path(model_name: 'player')
is_expected.to have_sele... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/actions/index_spec.rb | spec/integration/actions/index_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Index action', type: :request do
subject { page }
describe 'page' do
it 'shows "List of Models", should show filters and should show column headers' do
RailsAdmin.config.default_items_per_page = 1
2.times { FactoryBot.create :pla... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | true |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/widgets/nested_many_spec.rb | spec/integration/widgets/nested_many_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Nested many widget', type: :request, js: true do
subject { page }
let(:field_test) { FactoryBot.create :field_test }
let(:nested_field_tests) { %w[1 2].map { |i| NestedFieldTest.create! title: "title #{i}", field_test: field_test } }
before ... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/widgets/filtering_select_spec.rb | spec/integration/widgets/filtering_select_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Filtering select widget', type: :request, js: true do
subject { page }
let!(:teams) { ['Los Angeles Dodgers', 'Texas Rangers'].map { |name| FactoryBot.create :team, name: name } }
let(:player) { FactoryBot.create :player, team: teams[0] }
be... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/widgets/datetimepicker_spec.rb | spec/integration/widgets/datetimepicker_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Datetimepicker widget', type: :request, js: true do
subject { page }
before do
RailsAdmin.config FieldTest do
edit do
field :datetime_field
end
end
end
it 'is initially blank' do
visit new_path(model_name: 'f... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/widgets/remote_form_spec.rb | spec/integration/widgets/remote_form_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Remote form widget', type: :request, js: true do
subject { page }
describe 'modal' do
it 'supports focusing on sub-modals' do
visit new_path(model_name: 'division')
click_link 'Add a new League'
is_expected.to have_content ... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/widgets/nested_one_spec.rb | spec/integration/widgets/nested_one_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Nested one widget', type: :request, js: true do
subject { page }
let(:field_test) { FactoryBot.create :field_test }
before do
RailsAdmin.config(FieldTest) do
field :comment
end
end
it 'adds an nested item' do
visit edit_... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/widgets/filter_box_spec.rb | spec/integration/widgets/filter_box_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Filter box widget', type: :request, js: true do
subject { page }
it 'adds filters' do
RailsAdmin.config Player do
field :name
field :position
end
visit index_path(model_name: 'player')
is_expected.to have_no_css('#fil... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/widgets/filtering_multi_select_spec.rb | spec/integration/widgets/filtering_multi_select_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Filtering multi-select widget', type: :request, js: true do
subject { page }
let(:team) { FactoryBot.create :team }
let!(:players) { ['Cory Burns', 'Leonys Martin', 'Matt Garza'].map { |name| FactoryBot.create :player, name: name } }
before ... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/code_mirror_spec.rb | spec/integration/fields/code_mirror_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'CodeMirror field', type: :request do
subject { page }
it 'works without error', js: true do
RailsAdmin.config Draft do
edit do
field :notes, :code_mirror
end
end
expect { visit new_path(model_name: 'draft') }.not_... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/multiple_file_upload_spec.rb | spec/integration/fields/multiple_file_upload_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'MultipleFileUpload field', type: :request do
subject { page }
before do
RailsAdmin.config FieldTest do
field :string_field, :multiple_file_upload do
attachment do
delete_value { value }
def resource_url(_thu... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/carrierwave_spec.rb | spec/integration/fields/carrierwave_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Carrierwave field', type: :request, active_record: true do
subject { page }
before do
RailsAdmin.config FieldTest do
edit do
field :string_field
field :carrierwave_asset
end
end
end
it 'supports caching an... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/file_upload_spec.rb | spec/integration/fields/file_upload_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'FileUpload field', type: :request do
subject { page }
before do
RailsAdmin.config FieldTest do
field :string_field, :file_upload do
delete_method 'boolean_field'
def resource_url(_thumb = false)
value
... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/polymorphic_assosiation_spec.rb | spec/integration/fields/polymorphic_assosiation_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'PolymorphicAssociation field', type: :request do
subject { page }
context 'on create' do
it 'is editable', js: true do
@players = ['Jackie Robinson', 'Rob Wooten'].map { |name| FactoryBot.create :player, name: name }
visit new_pa... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/has_one_association_spec.rb | spec/integration/fields/has_one_association_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'HasOneAssociation field', type: :request do
subject { page }
it 'adds a related id to the has_one create draft link' do
@player = FactoryBot.create :player
visit edit_path(model_name: 'player', id: @player.id)
is_expected.to have_sel... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/paperclip_spec.rb | spec/integration/fields/paperclip_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Paperclip field', type: :request do
subject { page }
it 'shows a file upload field' do
RailsAdmin.config User do
edit do
field :avatar
end
end
visit new_path(model_name: 'user')
is_expected.to have_selector('i... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/enum_spec.rb | spec/integration/fields/enum_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Enum field', type: :request, active_record: true do
subject { page }
before do
allow_any_instance_of(Team).to receive(:color_enum).and_return(%w[blue green red])
end
describe 'for single value' do
before do
RailsAdmin.config T... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/active_storage_spec.rb | spec/integration/fields/active_storage_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'ActiveStorage field', type: :request, active_record: true do
subject { page }
let(:field_test) { FactoryBot.create :field_test }
before do
# To suppress 'SQLite3::BusyException: database is locked' exception
@original = page.driver.brow... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/datetime_spec.rb | spec/integration/fields/datetime_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Datetime field', type: :request do
subject { page }
before do
RailsAdmin.config FieldTest do
edit do
field :datetime_field
end
end
end
describe 'filtering' do
let!(:field_tests) do
[FactoryBot.create(:fi... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/hidden_spec.rb | spec/integration/fields/hidden_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Hidden field', type: :request do
subject { page }
describe '#default_value' do
before do
RailsAdmin::Config.authenticate_with { warden.authenticate! scope: :user }
RailsAdmin::Config.current_user_method(&:current_user)
logi... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/has_and_belongs_to_many_association_spec.rb | spec/integration/fields/has_and_belongs_to_many_association_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'HasAndBelongsToManyAssociation field', type: :request do
subject { page }
context 'on create' do
before do
@teams = FactoryBot.create_list(:team, 3)
post new_path(model_name: 'fan', fan: {name: 'John Doe', team_ids: [@teams[0].id... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/multiple_carrierwave_spec.rb | spec/integration/fields/multiple_carrierwave_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'MultipleCarrierwave field', type: :request, active_record: true do
subject { page }
before do
RailsAdmin.config FieldTest do
edit do
field :carrierwave_assets
end
end
end
it 'supports uploading multiple files', js... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/serialized_spec.rb | spec/integration/fields/serialized_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Serialized field', type: :request do
subject { page }
context 'with serialized objects' do
before do
RailsAdmin.config do |c|
c.model User do
configure :roles, :serialized
end
end
@user = FactoryB... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/has_many_association_spec.rb | spec/integration/fields/has_many_association_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'HasManyAssociation field', type: :request do
subject { page }
it 'adds a related id to the has_many create team link' do
@team = FactoryBot.create :team
visit edit_path(model_name: 'team', id: @team.id)
is_expected.to have_selector("... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/ck_editor_spec.rb | spec/integration/fields/ck_editor_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'CKEditor field', type: :request do
subject { page }
it 'works without error', js: true do
RailsAdmin.config Draft do
edit do
field :notes, :ck_editor
end
end
expect { visit new_path(model_name: 'draft') }.not_to r... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/action_text_spec.rb | spec/integration/fields/action_text_spec.rb | # frozen_string_literal: true
require 'spec_helper'
if defined?(ActionText)
RSpec.describe 'ActionText field', type: :request, js: true do
subject { page }
before do
RailsAdmin.config FieldTest do
edit do
field :action_text_field
end
end
end
it 'works without ... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/shrine_spec.rb | spec/integration/fields/shrine_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Shrine field', type: :request, active_record: true do
subject { page }
before do
RailsAdmin.config FieldTest do
edit do
field :string_field
field :shrine_asset
end
end
end
it 'supports caching an uploaded ... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/multiple_active_storage_spec.rb | spec/integration/fields/multiple_active_storage_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'MultipleActiveStorage field', type: :request, active_record: true do
subject { page }
before do
RailsAdmin.config FieldTest do
edit do
field :active_storage_assets
end
end
# To suppress 'SQLite3::BusyException: dat... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/wysihtml5_spec.rb | spec/integration/fields/wysihtml5_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Wysihtml5 field', type: :request do
subject { page }
it 'works without error', js: true do
RailsAdmin.config Draft do
edit do
field :notes, :wysihtml5
end
end
expect { visit new_path(model_name: 'draft') }.not_to ... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/color_spec.rb | spec/integration/fields/color_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Color field', type: :request do
subject { page }
it 'uses HTML5 color picker' do
RailsAdmin.config Team do
field :color, :color
end
visit new_path(model_name: 'team')
is_expected.to have_selector('#team_color[type="color"]'... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/base_spec.rb | spec/integration/fields/base_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Base field', type: :request do
subject { page }
describe '#default_value' do
it 'is set for all types of input fields' do
RailsAdmin.config do |config|
config.excluded_models = []
config.model(FieldTest) do
fi... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/active_record_enum_spec.rb | spec/integration/fields/active_record_enum_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'ActiveRecordEnum field', type: :request, active_record: true do
subject { page }
describe 'for string-keyed enum' do
before do
RailsAdmin.config FieldTest do
edit do
field :string_enum_field do
default_val... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/time_spec.rb | spec/integration/fields/time_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Time field', type: :request, active_record: true do
subject { page }
before do
RailsAdmin.config FieldTest do
edit do
field :time_field
end
end
end
describe 'filtering' do
let!(:field_tests) do
[FactoryB... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/belongs_to_association_spec.rb | spec/integration/fields/belongs_to_association_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'BelongsToAssociation field', type: :request do
subject { page }
it 'does not add a related id to the belongs_to create team link' do
@player = FactoryBot.create :player
visit edit_path(model_name: 'player', id: @player.id)
is_expecte... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/boolean_spec.rb | spec/integration/fields/boolean_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Boolean field', type: :request do
subject { page }
let(:field_test) { FactoryBot.create :field_test }
context 'if nullable' do
before do
RailsAdmin.config FieldTest do
field :boolean_field
end
end
it 'shows 3 r... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/simple_mde_spec.rb | spec/integration/fields/simple_mde_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'SimpleMDE field', type: :request do
subject { page }
it 'works without error', js: true do
RailsAdmin.config Draft do
edit do
field :notes, :simple_mde
end
end
expect { visit new_path(model_name: 'draft') }.not_to... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/date_spec.rb | spec/integration/fields/date_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Date field', type: :request do
subject { page }
before do
RailsAdmin.config FieldTest do
field :id
field :date_field
end
end
describe 'filtering' do
let!(:field_tests) do
[FactoryBot.create(:field_test, date_fie... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/integration/fields/floara_spec.rb | spec/integration/fields/floara_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Floara field', type: :request do
subject { page }
it 'works without error', js: true do
RailsAdmin.config Draft do
edit do
field :notes, :froala
end
end
expect { visit new_path(model_name: 'draft') }.not_to raise_... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/helpers/rails_admin/main_helper_spec.rb | spec/helpers/rails_admin/main_helper_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::MainHelper, type: :helper do
describe '#rails_admin_form_for' do
let(:html_form) do
helper.rails_admin_form_for(FieldTest.new, url: new_path(model_name: 'field_test')) {}
end
let(:html_form_with_attrs) do
helper.... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/helpers/rails_admin/form_builder_spec.rb | spec/helpers/rails_admin/form_builder_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'RailsAdmin::FormBuilder', type: :helper do
describe '#generate' do
before do
RailsAdmin.config Player do
create do
include_all_fields
field :number, :hidden
end
end
allow(helper).to receive(... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/helpers/rails_admin/application_helper_spec.rb | spec/helpers/rails_admin/application_helper_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::ApplicationHelper, type: :helper do
describe '#authorized?' do
let(:abstract_model) { RailsAdmin.config(FieldTest).abstract_model }
it 'doesn\'t use unpersisted objects' do
expect(helper).to receive(:action).with(:edit, ab... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/controllers/rails_admin/main_controller_spec.rb | spec/controllers/rails_admin/main_controller_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::MainController, type: :controller do
routes { RailsAdmin::Engine.routes }
def get(action, params)
super action, params: params
end
before do
controller.instance_variable_set :@action, RailsAdmin::Config::Actions.find(:ind... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/controllers/rails_admin/application_controller_spec.rb | spec/controllers/rails_admin/application_controller_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::ApplicationController, type: :controller do
describe '#to_model_name' do
it 'works with modules' do
expect(controller.to_model_name('conversations~conversation')).to eq('Conversations::Conversation')
end
end
describe '... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/version_spec.rb | spec/rails_admin/version_spec.rb | # frozen_string_literal: true
require 'fileutils'
require 'spec_helper'
RSpec.describe 'RailsAdmin::Version' do
describe '#warn_with_js_version' do
it 'does nothing when the versions match' do
allow(RailsAdmin::Version).to receive(:actual_js_version).and_return('3.0.0')
allow(RailsAdmin::Version).to... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/abstract_model_spec.rb | spec/rails_admin/abstract_model_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::AbstractModel do
describe '.all' do
it 'returns abstract models for all models' do
expect(RailsAdmin::AbstractModel.all.map(&:model)).to include Player, Team
end
it 'does not pick up a model without table', active_reco... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/active_record_extension_spec.rb | spec/rails_admin/active_record_extension_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require File.expand_path('../../config/initializers/active_record_extensions', __dir__)
RSpec.describe 'ActiveRecord::Base', active_record: true do
describe '#safe_send' do
it 'only calls #read_attribute once' do
@player = Player.new
@player.number... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/config_spec.rb | spec/rails_admin/config_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Config do
describe '.included_models' do
it 'only uses included models' do
RailsAdmin.config.included_models = [Team, League]
expect(RailsAdmin::AbstractModel.all.collect(&:model)).to eq([League, Team]) # it gets sorted
... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/engine_spec.rb | spec/rails_admin/engine_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Engine do
context 'on class unload' do
let(:fields) { RailsAdmin.config(Player).edit.fields }
before do
Rails.application.config.cache_classes = false
RailsAdmin.config(Player) do
field :name
field :nu... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/install_generator_spec.rb | spec/rails_admin/install_generator_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'generators/rails_admin/install_generator'
RSpec.describe RailsAdmin::InstallGenerator, type: :generator do
destination File.expand_path('../dummy_app/tmp/generator', __dir__)
arguments ['admin', "--asset=#{CI_ASSET}", '--force']
before do
prepare... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/support/hash_helper_spec.rb | spec/rails_admin/support/hash_helper_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::HashHelper do
let(:hash) do
{
'subject' => 'Test',
'user' => {
name: 'Dirk',
'title' => 'Holistic Detective',
'clients' => [
{name: 'Zaphod'},
{'name' => 'Arthur'},
],
... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/support/datetime_spec.rb | spec/rails_admin/support/datetime_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::Support::Datetime do
describe '#to_flatpickr_format' do
{
'%D de %M de %Y, %H:%M:%S' => 'm/d/y \d\e i \d\e Y, H:i:S',
'%d/%-m/%Y, %H:%M:%S' => 'd/n/Y, H:i:S',
'%d de %B de %Y' => 'd \d\e F \d\e Y',
'%-d %B %Y'... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/support/csv_converter_spec.rb | spec/rails_admin/support/csv_converter_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe RailsAdmin::CSVConverter do
it 'keeps headers ordering' do
RailsAdmin.config(Player) do
export do
field :number
field :name
end
end
FactoryBot.create :player
objects = Player.all
schema = {only: %i[nu... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/adapters/active_record_spec.rb | spec/rails_admin/adapters/active_record_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'timecop'
RSpec.describe 'RailsAdmin::Adapters::ActiveRecord', active_record: true do
let(:activerecord_config) do
if ::ActiveRecord::Base.respond_to? :connection_db_config
::ActiveRecord::Base.connection_db_config.configuration_hash
else
... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/adapters/mongoid_spec.rb | spec/rails_admin/adapters/mongoid_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'RailsAdmin::Adapters::Mongoid', mongoid: true do
describe '#associations' do
it 'returns Association class' do
expect(RailsAdmin::AbstractModel.new(Player).associations.first).
to be_a_kind_of RailsAdmin::Adapters::Mongoid::Associ... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/adapters/mongoid/object_extension_spec.rb | spec/rails_admin/adapters/mongoid/object_extension_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'RailsAdmin::Adapters::Mongoid::ObjectExtension', mongoid: true do
describe 'has_many association' do
let(:players) { FactoryBot.create_list :player, 2 }
before do
class TeamWithAutoSave < Team
has_many :players, inverse_of: :t... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/adapters/mongoid/association_spec.rb | spec/rails_admin/adapters/mongoid/association_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'RailsAdmin::Adapters::Mongoid::Association', mongoid: true do
before :all do
RailsAdmin::AbstractModel.reset_polymorphic_parents
class MongoBlog
include Mongoid::Document
has_many :mongo_posts
has_many :mongo_comments, as... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/adapters/mongoid/property_spec.rb | spec/rails_admin/adapters/mongoid/property_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'RailsAdmin::Adapters::Mongoid::Property', mongoid: true do
subject { RailsAdmin::AbstractModel.new(FieldTest).properties.detect { |p| p.name == field } }
describe '_id field' do
let(:field) { :_id }
it 'has correct values' do
expe... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/adapters/active_record/object_extension_spec.rb | spec/rails_admin/adapters/active_record/object_extension_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'RailsAdmin::Adapters::ActiveRecord::ObjectExtension', active_record: true do
describe '#assign_attributes' do
let(:player) { Player.new }
let(:object) { player.extend RailsAdmin::Adapters::ActiveRecord::ObjectExtension }
it 'does not c... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/adapters/active_record/association_spec.rb | spec/rails_admin/adapters/active_record/association_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'timecop'
RSpec.describe 'RailsAdmin::Adapters::ActiveRecord::Association', active_record: true do
before :all do
RailsAdmin::AbstractModel.reset_polymorphic_parents
class ARBlog < Tableless
has_many :a_r_posts
has_many :a_r_comments, ... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
railsadminteam/rails_admin | https://github.com/railsadminteam/rails_admin/blob/d8e0809ea4b38415ace5b0d038fca317d805a3c1/spec/rails_admin/adapters/active_record/property_spec.rb | spec/rails_admin/adapters/active_record/property_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'timecop'
RSpec.describe 'RailsAdmin::Adapters::ActiveRecord::Property', active_record: true do
describe 'string field' do
subject { RailsAdmin::AbstractModel.new('Player').properties.detect { |f| f.name == :name } }
it 'returns correct values' do... | ruby | MIT | d8e0809ea4b38415ace5b0d038fca317d805a3c1 | 2026-01-04T15:39:16.877032Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.