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
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/menu_steps.rb
features/step_definitions/menu_steps.rb
# frozen_string_literal: true Then(/^I should see a menu item for "([^"]*)"$/) do |name| expect(page).to have_css "#main-menu li a", text: name end Then(/^I should not see a menu item for "([^"]*)"$/) do |name| expect(page).to have_no_css "#main-menu li a", text: name end Then(/^the "([^"]*)" menu item should be ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/index_scope_steps.rb
features/step_definitions/index_scope_steps.rb
# frozen_string_literal: true Then(/^I should( not)? see the scope "([^"]*)"( selected)?$/) do |negate, name, selected| should = "I should#{' not' if negate}" scope = ".scopes#{' .index-button-selected' if selected}" step %{#{should} see "#{name}" within "#{scope}"} end Then(/^I should see the scope "([^"]*)" no...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/action_link_steps.rb
features/step_definitions/action_link_steps.rb
# frozen_string_literal: true Then(/^I should see a member link to "([^"]*)"$/) do |name| expect(page).to have_css(".data-table-resource-actions > a", text: name) end Then(/^I should not see a member link to "([^"]*)"$/) do |name| %{Then I should not see "#{name}" within ".data-table-resource-actions > a"} end Th...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/comment_steps.rb
features/step_definitions/comment_steps.rb
# frozen_string_literal: true Then(/^I should see a comment by "([^"]*)"$/) do |name| step %{I should see "#{name}" within "[data-test-comment-container]"} end Then(/^I should( not)? be able to add a comment$/) do |negate| should = negate ? :not_to : :to expect(page).send should, have_button("Add Comment") end ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/site_title_steps.rb
features/step_definitions/site_title_steps.rb
# frozen_string_literal: true Around "@site_title" do |scenario, block| previous_site_title = ActiveAdmin.application.site_title begin block.call ensure ActiveAdmin.application.site_title = previous_site_title end end Then(/^I should see the site title "([^"]*)"$/) do |title| expect(page).to have_cs...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/filesystem_steps.rb
features/step_definitions/filesystem_steps.rb
# frozen_string_literal: true module ActiveAdminContentsRollback def files @files ||= {} end # Records the contents of a file the first time we are # about to change it def record(filename) contents = File.read(filename) rescue nil files[filename] = contents unless files.has_key? filename end ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/attribute_steps.rb
features/step_definitions/attribute_steps.rb
# frozen_string_literal: true Then(/^I should( not)? see the attribute "([^"]*)" with "([^"]*)"$/) do |negate, title, value| elems = all ".attributes-table th:contains('#{title}') ~ td:contains('#{value}')" if negate expect(elems.first).to eq(nil), "attribute missing" else expect(elems.first).to_not eq(n...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/breadcrumb_steps.rb
features/step_definitions/breadcrumb_steps.rb
# frozen_string_literal: true Around "@breadcrumb" do |scenario, block| previous_breadcrumb = ActiveAdmin.application.breadcrumb begin block.call ensure ActiveAdmin.application.breadcrumb = previous_breadcrumb end end Then(/^I should see a link to "([^"]*)" in the breadcrumb$/) do |text| expect(page...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/batch_action_steps.rb
features/step_definitions/batch_action_steps.rb
# frozen_string_literal: true Then(/^I (should|should not) see the batch action :([^\s]*) "([^"]*)"$/) do |maybe, sym, title| selector = "[data-batch-action-item]" selector += "[href='#'][data-action='#{sym}']" if maybe == "should" verb = maybe == "should" ? :to : :to_not expect(page).send verb, have_css(selec...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/filter_steps.rb
features/step_definitions/filter_steps.rb
# frozen_string_literal: true Around "@filters" do |scenario, block| previous_current_filters = ActiveAdmin.application.current_filters begin block.call ensure ActiveAdmin.application.current_filters = previous_current_filters end end Then(/^I should see a select filter for "([^"]*)"$/) do |label| e...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/features/step_definitions/user_steps.rb
features/step_definitions/user_steps.rb
# frozen_string_literal: true def ensure_user_created(email) AdminUser.create_with(password: "password", password_confirmation: "password").find_or_create_by!(email: email) end Given(/^(?:I am logged|log) out$/) do click_on "Sign out" if page.all(:css, "a", text: "Sign out").any? end Given(/^I am logged in$/) do ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/rails_helper.rb
spec/rails_helper.rb
# frozen_string_literal: true require "spec_helper" ENV["RAILS_ENV"] = "test" require_relative "../tasks/test_application" require "#{ActiveAdmin::TestApplication.new.full_app_dir}/config/environment.rb" require "rspec/rails" # Disabling authentication in specs so that we don't have to worry about # it allover the...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true require "simplecov" if ENV["COVERAGE"] == "true" require_relative "support/matchers/perform_database_query_matcher" require_relative "support/shared_contexts/capture_stderr" require_relative "support/active_support_deprecation" RSpec.configure do |config| config.disable_monkey_patching...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/tasks/gemfile_spec.rb
spec/tasks/gemfile_spec.rb
# frozen_string_literal: true RSpec.describe "Gemfile sanity" do it "is up to date" do gemfile = ENV["BUNDLE_GEMFILE"] || "Gemfile" current_lockfile = File.read("#{gemfile}.lock") new_lockfile = Bundler.with_original_env do `bundle lock --print` end msg = "Please update #{gemfile}'s lock f...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/tasks/local_spec.rb
spec/tasks/local_spec.rb
# frozen_string_literal: true require "open3" RSpec.describe "local task" do let(:local) do Open3.capture2e("bin/rake local runner 'AdminUser.first'") end it "succeeds" do expect(local[1]).to be_success, local[0] end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/active_admin_integration_spec_helper.rb
spec/support/active_admin_integration_spec_helper.rb
# frozen_string_literal: true module ActiveAdminIntegrationSpecHelper def with_resources_during(example) load_resources { yield } example.run load_resources {} end def reload_menus! ActiveAdmin.application.namespaces.each { |n| n.reset_menu! } end # Sometimes we need to reload the routes w...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/rails_template_with_data.rb
spec/support/rails_template_with_data.rb
# frozen_string_literal: true apply File.expand_path("rails_template.rb", __dir__) inject_into_file "config/initializers/active_admin.rb", <<-RUBY, after: "ActiveAdmin.setup do |config|" config.comments_menu = { parent: 'Administrative' } RUBY inject_into_file "app/admin/admin_users.rb", <<-RUBY, after: "ActiveAdm...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/simplecov_regular_env.rb
spec/support/simplecov_regular_env.rb
# frozen_string_literal: true if ENV["COVERAGE"] == "true" require "simplecov" SimpleCov.command_name ["regular specs", ENV["TEST_ENV_NUMBER"]].join(" ").rstrip end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/simplecov_changes_env.rb
spec/support/simplecov_changes_env.rb
# frozen_string_literal: true if ENV["COVERAGE"] == "true" require "simplecov" SimpleCov.command_name "filesystem changes specs" end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/rails_template.rb
spec/support/rails_template.rb
# frozen_string_literal: true # Rails template to build the sample app for specs gem "cssbundling-rails" create_file "app/assets/config/manifest.js" rails_command "css:install:tailwind" # Remove default configuration generated: https://github.com/rails/cssbundling-rails/blob/v1.4.2/lib/install/tailwind/install.rb#L7...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/active_support_deprecation.rb
spec/support/active_support_deprecation.rb
# frozen_string_literal: true # Module to help with deprecation warnings in specs. module ActiveAdmin # A good name for this module would be ActiveAdmin::ActiveSupport::Deprecation, but # that would require a lot of changes in the codebase because, for example, there are references to # ActiveSupport::Notificati...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/shared_contexts/capture_stderr.rb
spec/support/shared_contexts/capture_stderr.rb
# frozen_string_literal: true RSpec.shared_context "capture stderr" do around do |example| original_stderr = $stderr $stderr = StringIO.new example.run $stderr = original_stderr end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/post_decorator.rb
spec/support/templates/post_decorator.rb
# frozen_string_literal: true require "draper" class PostDecorator < Draper::Decorator decorates :post delegate_all # @param attributes [Hash] def assign_attributes(attributes) object.assign_attributes attributes.except(:virtual_title) self.virtual_title = attributes.fetch(:virtual_title) if attribute...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/post_poro_decorator.rb
spec/support/templates/post_poro_decorator.rb
# frozen_string_literal: true class PostPoroDecorator delegate_missing_to :post def initialize(post) @post = post end def decorator_method "A method only available on the PORO decorator" end private attr_reader :post end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/helpers/time_helper.rb
spec/support/templates/helpers/time_helper.rb
# frozen_string_literal: true module TimeHelper def format_time(time, format: :long) time end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/policies/application_policy.rb
spec/support/templates/policies/application_policy.rb
# frozen_string_literal: true class ApplicationPolicy attr_reader :user, :record def initialize(user, record) @user = user @record = record end def index? true end def show? scope.where(id: record.id).exists? end def new? create? end def create? true end def edit? ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/policies/category_policy.rb
spec/support/templates/policies/category_policy.rb
# frozen_string_literal: true class CategoryPolicy < ApplicationPolicy end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/policies/post_policy.rb
spec/support/templates/policies/post_policy.rb
# frozen_string_literal: true class PostPolicy < ApplicationPolicy def new? true end def create? record.category.nil? || record.category.name != "Announcements" || user.is_a?(User::VIP) end def update? record.author == user end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/policies/admin_user_policy.rb
spec/support/templates/policies/admin_user_policy.rb
# frozen_string_literal: true class AdminUserPolicy < ApplicationPolicy end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/policies/user_policy.rb
spec/support/templates/policies/user_policy.rb
# frozen_string_literal: true class UserPolicy < ApplicationPolicy end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/policies/store_policy.rb
spec/support/templates/policies/store_policy.rb
# frozen_string_literal: true class StorePolicy < ApplicationPolicy end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/policies/company_policy.rb
spec/support/templates/policies/company_policy.rb
# frozen_string_literal: true class CompanyPolicy < ApplicationPolicy end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/policies/tag_policy.rb
spec/support/templates/policies/tag_policy.rb
# frozen_string_literal: true class TagPolicy < ApplicationPolicy end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/policies/active_admin/page_policy.rb
spec/support/templates/policies/active_admin/page_policy.rb
# frozen_string_literal: true module ActiveAdmin class PagePolicy < ApplicationPolicy def show? case record.name when "Dashboard" true else false end end end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/policies/active_admin/comment_policy.rb
spec/support/templates/policies/active_admin/comment_policy.rb
# frozen_string_literal: true module ActiveAdmin class CommentPolicy < ApplicationPolicy def destroy? record.author == user end class Scope < ApplicationPolicy::Scope def resolve scope.where(author: user) end end end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/admin/companies.rb
spec/support/templates/admin/companies.rb
# frozen_string_literal: true ActiveAdmin.register Company do permit_params :name, store_ids: [] form do |f| f.inputs 'Company' do f.input :name f.input :stores end f.actions end show do attributes_table :name, :stores, :created_at, :update_at end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/admin/stores.rb
spec/support/templates/admin/stores.rb
# frozen_string_literal: true ActiveAdmin.register Store do permit_params :name index pagination_total: false end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/models/tag.rb
spec/support/templates/models/tag.rb
# frozen_string_literal: true class Tag < ApplicationRecord has_many :taggings has_many :posts, through: :taggings end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/models/publisher.rb
spec/support/templates/models/publisher.rb
# frozen_string_literal: true class Publisher < User end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/models/category.rb
spec/support/templates/models/category.rb
# frozen_string_literal: true class Category < ApplicationRecord has_many :posts, foreign_key: :custom_category_id has_many :authors, through: :posts accepts_nested_attributes_for :posts validates :name, presence: true end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/models/store.rb
spec/support/templates/models/store.rb
# frozen_string_literal: true class Store < ApplicationRecord end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/models/post.rb
spec/support/templates/models/post.rb
# frozen_string_literal: true class Post < ApplicationRecord belongs_to :category, foreign_key: :custom_category_id, optional: true, counter_cache: true belongs_to :author, class_name: "User", optional: true has_many :taggings has_many :tags, through: :taggings accepts_nested_attributes_for :author accepts_...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/models/profile.rb
spec/support/templates/models/profile.rb
# frozen_string_literal: true class Profile < ApplicationRecord belongs_to :user end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/models/tagging.rb
spec/support/templates/models/tagging.rb
# frozen_string_literal: true class Tagging < ApplicationRecord belongs_to :post, optional: true belongs_to :tag, optional: true delegate :name, to: :tag, prefix: true end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/models/company.rb
spec/support/templates/models/company.rb
# frozen_string_literal: true class Company < ApplicationRecord has_and_belongs_to_many :stores validates :name, presence: true end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/models/user.rb
spec/support/templates/models/user.rb
# frozen_string_literal: true class User < ApplicationRecord class VIP < self end has_many :posts, foreign_key: "author_id" has_many :articles, class_name: "Post", foreign_key: "author_id" has_one :profile accepts_nested_attributes_for :profile, allow_destroy: true accepts_nested_attributes_for :posts, al...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates/models/blog/post.rb
spec/support/templates/models/blog/post.rb
# frozen_string_literal: true class Blog::Post < ApplicationRecord belongs_to :category, foreign_key: :custom_category_id belongs_to :author, class_name: "User" has_many :taggings accepts_nested_attributes_for :author accepts_nested_attributes_for :taggings, allow_destroy: true end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/matchers/perform_database_query_matcher.rb
spec/support/matchers/perform_database_query_matcher.rb
# frozen_string_literal: true RSpec::Matchers.define :perform_database_query do |query| match do |block| query_regexp = query.is_a?(Regexp) ? query : Regexp.new(Regexp.escape(query)) @match = nil callback = lambda do |_name, _started, _finished, _unique_id, payload| if query_regexp.match?(payload...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates_with_data/admin/users.rb
spec/support/templates_with_data/admin/users.rb
# frozen_string_literal: true ActiveAdmin.register User do config.create_another = true permit_params :first_name, :last_name, :username, :age preserve_default_filters! filter :first_name_or_last_name_cont, as: :string, label: "First or Last Name" index do selectable_column id_column column :fi...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates_with_data/admin/posts.rb
spec/support/templates_with_data/admin/posts.rb
# frozen_string_literal: true ActiveAdmin.register Post do permit_params :custom_category_id, :author_id, :title, :body, :published_date, :position, :starred, taggings_attributes: [ :id, :tag_id, :name, :position, :_destroy ] filter :author filter :category, as: :check_boxes filter :taggings filter :tags, as...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates_with_data/admin/categories.rb
spec/support/templates_with_data/admin/categories.rb
# frozen_string_literal: true ActiveAdmin.register Category do config.create_another = true permit_params :name, :description end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates_with_data/admin/kitchen_sink.rb
spec/support/templates_with_data/admin/kitchen_sink.rb
# frozen_string_literal: true ActiveAdmin.register_page "KitchenSink" do content do panel "About ActiveAdmin" do para class: "mb-4" do a "Active Admin", href: "https://github.com/activeadmin/activeadmin" text_node "is a" span "Ruby on Rails", class: "text-red-500" text_node "...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates_with_data/admin/tags.rb
spec/support/templates_with_data/admin/tags.rb
# frozen_string_literal: true ActiveAdmin.register Tag do config.create_another = true permit_params :name index do selectable_column id_column column :name column :created_at actions do |tag| item "Preview", admin_tag_path(tag) end end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/support/templates_with_data/admin/components/custom_index.rb
spec/support/templates_with_data/admin/components/custom_index.rb
# frozen_string_literal: true module ActiveAdmin module Views class CustomIndex < ActiveAdmin::Component def build(page_presenter, collection) add_class("custom-index") set_attribute("data-index-as", "custom") if active_admin_config.batch_actions.any? div class: "p-3" do ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/requests/default_namespace_spec.rb
spec/requests/default_namespace_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Application, type: :request do let(:resource) { ActiveAdmin.register Category } [false, nil].each do |value| describe "with a #{value} default namespace" do around do |example| with_custom_default_namespace(value) {...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/requests/memory_spec.rb
spec/requests/memory_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe "Memory Leak", type: :request, if: RUBY_ENGINE == "ruby" do around do |example| with_resources_during(example) { ActiveAdmin.register(Category) } end def count_instances_of(klass) ObjectSpace.each_object(klass) {} end [ActiveAdmin:...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/helpers/breadcrumb_helper_spec.rb
spec/helpers/breadcrumb_helper_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::BreadcrumbHelper, type: :helper do describe "generating a trail from paths" do let(:actions) { ActiveAdmin::BaseController::ACTIVE_ADMIN_ACTIONS } let(:user) { double display_name: "Jane Doe" } let(:user_config) do do...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/helpers/layout_helper_spec.rb
spec/helpers/layout_helper_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::LayoutHelper, type: :helper do describe "active_admin_application" do it "returns the application instance" do expect(helper.active_admin_application).to eq ActiveAdmin.application end end describe "set_page_title" do...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/helpers/display_helper_spec.rb
spec/helpers/display_helper_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::DisplayHelper, type: :helper do let(:active_admin_namespace) { helper.active_admin_application.namespaces[:admin] } let(:displayed_name) { helper.display_name(resource) } before do helper.class.send(:include, ActiveAdmin::Layou...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/helpers/filter_form_helper_spec.rb
spec/helpers/filter_form_helper_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::FormHelper, type: :helper do def render_filter(search, filters) allow(helper).to receive(:collection_path).and_return("/posts") allow(helper).to receive(:a_helper_method).and_return("A Helper Method") render_arbre_component(...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/helpers/auto_link_helper_spec.rb
spec/helpers/auto_link_helper_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::AutoLinkHelper, type: :helper do let(:linked_post) { helper.auto_link(post) } let(:active_admin_namespace) { ActiveAdmin.application.namespace(:admin) } let(:post) { Post.create! title: "Hello World" } before do helper.class...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/helpers/index_helper_spec.rb
spec/helpers/index_helper_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::IndexHelper, type: :helper do describe "#collection_size" do before do Post.create!(title: "A post") Post.create!(title: "A post") Post.create!(title: "Another post") end it "should take the defined collec...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/helpers/form_helper_spec.rb
spec/helpers/form_helper_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::FormHelper, type: :helper do describe ".active_admin_form_for" do let(:resource) { double "resource" } it "calls semantic_form_for with the ActiveAdmin form builder" do expect(helper).to receive(:semantic_form_for).with(r...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/locales/i18n_spec.rb
spec/locales/i18n_spec.rb
# frozen_string_literal: true require "i18n/tasks" require "i18n-spec" Dir.glob("config/locales/*.yml") do |locale_file| RSpec.describe locale_file do it { is_expected.to be_parseable } it { is_expected.to have_one_top_level_namespace } it { is_expected.to be_named_like_top_level_namespace } it { is_...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/page_spec.rb
spec/unit/page_spec.rb
# frozen_string_literal: true require "rails_helper" require File.expand_path("config_shared_examples", __dir__) module ActiveAdmin RSpec.describe Page do it_should_behave_like "ActiveAdmin::Resource" let(:application) { ActiveAdmin::Application.new } let(:namespace) { Namespace.new(application, :admin)...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/order_clause_spec.rb
spec/unit/order_clause_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::OrderClause do subject { described_class.new(config, clause) } let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new application, :admin } let(:config) { ActiveAdmin::Resource.new namespa...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/routing_spec.rb
spec/unit/routing_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe "Routing", type: :routing do let(:namespaces) { ActiveAdmin.application.namespaces } it "should only have the namespaces necessary for route testing" do expect(namespaces.names).to eq [:admin] end describe "admin dashboard" do around...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/menu_collection_spec.rb
spec/unit/menu_collection_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::MenuCollection do let(:menus) { ActiveAdmin::MenuCollection.new } describe "#add" do it "should initialize a new menu when first item" do menus.add :default, label: "Hello World" expect(menus.fetch(:default).items.si...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/settings_node_spec.rb
spec/unit/settings_node_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::SettingsNode do subject { ActiveAdmin::SettingsNode.build } let!(:child) { ActiveAdmin::SettingsNode.build(subject) } context "parent setting includes foo" do before { subject.register :foo, true } it "returns parent setti...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/dependency_spec.rb
spec/unit/dependency_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Dependency do describe "method_missing" do before do allow(Gem).to receive(:loaded_specs) .and_return "foo" => Gem::Specification.new("foo", "1.2.3") end it "returns a Matcher" do expect(described_class....
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/resource_collection_spec.rb
spec/unit/resource_collection_spec.rb
# frozen_string_literal: true require "rails_helper" require "active_admin/resource_collection" RSpec.describe ActiveAdmin::ResourceCollection do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new application, :admin } let(:collection) { ActiveAdmin::ResourceCollectio...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/devise_spec.rb
spec/unit/devise_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Devise::Controller do let(:controller_class) do klass = Class.new do def self.layout(*); end def self.helper(*); end end klass.send(:include, ActiveAdmin::Devise::Controller) klass end let(:controller) {...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/active_admin_spec.rb
spec/unit/active_admin_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin do %w(register register_page unload! load! routes).each do |method| it "delegates ##{method} to application" do expect(ActiveAdmin.application).to receive(method) ActiveAdmin.send(method) end end end
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/dsl_spec.rb
spec/unit/dsl_spec.rb
# frozen_string_literal: true require "rails_helper" module MockModuleToInclude def self.included(dsl) end end RSpec.describe ActiveAdmin::DSL do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new application, :admin } let(:resource_config) { namespace.register P...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/menu_item_spec.rb
spec/unit/menu_item_spec.rb
# frozen_string_literal: true require "rails_helper" require "active_admin/menu" require "active_admin/menu_item" module ActiveAdmin RSpec.describe MenuItem do it "should have a label" do item = MenuItem.new(label: "Dashboard") expect(item.label).to eq "Dashboard" end it "should have a url" ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/resource_registration_spec.rb
spec/unit/resource_registration_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe "Registering an object to administer" do let(:application) { ActiveAdmin::Application.new } context "with no configuration" do let(:namespace) { ActiveAdmin::Namespace.new(application, :admin) } before do application.namespaces[nam...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/scope_spec.rb
spec/unit/scope_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Scope do describe "creating a scope" do subject { scope } context "when just a scope method" do let(:scope) { ActiveAdmin::Scope.new :published } describe "#name" do subject { super().name } it { is...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/controller_filters_spec.rb
spec/unit/controller_filters_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Application do let(:application) { ActiveAdmin::Application.new } let(:controllers) { application.controllers_for_filters } it "controllers_for_filters" do expect(application.controllers_for_filters).to eq [ ActiveAdmin::...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/action_builder_spec.rb
spec/unit/action_builder_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe "defining actions from registration blocks", type: :controller do let(:klass) { Admin::PostsController } before do load_resources { action! } @controller = klass.new end describe "creates a member action" do after do klass...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/comments_spec.rb
spec/unit/comments_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe "Comments" do let(:application) { ActiveAdmin::Application.new } describe ActiveAdmin::Comment do let(:comment) { ActiveAdmin::Comment.new } let(:user) { User.create!(first_name: "John", last_name: "Doe") } let(:post) { Post.create!...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/collection_decorator_spec.rb
spec/unit/collection_decorator_spec.rb
# frozen_string_literal: true require "rails_helper" class NumberDecorator def initialize(number) @number = number end def selectable? @number.even? end end RSpec.describe ActiveAdmin::CollectionDecorator do describe "#decorated_collection" do subject { collection.decorated_collection } let...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/csv_builder_spec.rb
spec/unit/csv_builder_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::CSVBuilder do describe ".default_for_resource using Post" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new(application, :admin) } let(:resource) { ActiveAdmin::Resource.new(n...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/menu_spec.rb
spec/unit/menu_spec.rb
# frozen_string_literal: true require "rails_helper" require "active_admin/menu" require "active_admin/menu_item" include ActiveAdmin RSpec.describe ActiveAdmin::Menu do context "with no items" do it "should have an empty item collection" do menu = Menu.new expect(menu.items).to be_empty end ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/form_builder_spec.rb
spec/unit/form_builder_spec.rb
# frozen_string_literal: true require "rails_helper" require "rspec/mocks/standalone" RSpec.describe ActiveAdmin::FormBuilder do # Setup an ActionView::Base object which can be used for # generating the form for. let(:helpers) do view = mock_action_view def view.posts_path "/posts" end def...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/belongs_to_spec.rb
spec/unit/belongs_to_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Resource::BelongsTo do around do |example| with_resources_during(example) do ActiveAdmin.register User ActiveAdmin.register(Post) { belongs_to :user } end end let(:user_config) { ActiveAdmin.register User } le...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/dynamic_settings_spec.rb
spec/unit/dynamic_settings_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::DynamicSettingsNode do subject { ActiveAdmin::DynamicSettingsNode.build } context "StringSymbolOrProcSetting" do before { subject.register :foo, "bar", :string_symbol_or_proc } it "should pass through a string" do subj...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/namespace_spec.rb
spec/unit/namespace_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Namespace do let(:application) { ActiveAdmin::Application.new } context "when new" do let(:namespace) { ActiveAdmin::Namespace.new(application, :admin) } it "should have an application instance" do expect(namespace.app...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/application_spec.rb
spec/unit/application_spec.rb
# frozen_string_literal: true require "rails_helper" require "fileutils" RSpec.describe ActiveAdmin::Application do let(:application) { ActiveAdmin::Application.new } it "should have a default load path of ['app/admin']" do expect(application.load_paths).to eq [File.expand_path("app/admin", application.app_pa...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/pundit_adapter_spec.rb
spec/unit/pundit_adapter_spec.rb
# frozen_string_literal: true require "rails_helper" class DefaultPolicy < ApplicationPolicy def respond_to_missing?(method, include_private = false) method.to_s[0...3] == "foo" || super end def method_missing(method, *args, &block) method.to_s[4...7] == "yes" if method.to_s[0...3] == "foo" end cla...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/config_shared_examples.rb
spec/unit/config_shared_examples.rb
# frozen_string_literal: true RSpec.shared_examples_for "ActiveAdmin::Resource" do describe "namespace" do it "should return the namespace" do expect(config.namespace).to eq(namespace) end end describe "page_presenters" do it "should return an empty hash by default" do expect(config.page_...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/cancan_adapter_spec.rb
spec/unit/cancan_adapter_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::CanCanAdapter do describe "full integration" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new(application, "Admin") } let(:resource) { namespace.register(Post) } let :ab...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/resource_spec.rb
spec/unit/resource_spec.rb
# frozen_string_literal: true require "rails_helper" require File.expand_path("config_shared_examples", __dir__) module ActiveAdmin RSpec.describe Resource do it_should_behave_like "ActiveAdmin::Resource" around do |example| with_resources_during(example) { namespace.register Category } end l...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/resource_controller_spec.rb
spec/unit/resource_controller_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::ResourceController, type: :controller do let(:controller) { Admin::PostsController.new } describe "callbacks" do around do |example| with_resources_during(example) do ActiveAdmin.register(Post) do after_bu...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/async_count_spec.rb
spec/unit/async_count_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::AsyncCount do include ActiveAdmin::IndexHelper def seed_posts [1, 2].map do |i| Post.create!(title: "Test #{i}", author_id: i * 100) end end it "can be passed to the collection_size helper", if: Post.respond_to?(:a...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/component_spec.rb
spec/unit/component_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Component do let(:component_class) { Class.new(described_class) } let(:component) { component_class.new } it "should be a subclass of an html div" do expect(ActiveAdmin::Component.ancestors).to include(Arbre::HTML::Div) end ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/batch_actions/settings_spec.rb
spec/unit/batch_actions/settings_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe "Batch Actions Settings" do let(:app) { ActiveAdmin::Application.new } let(:ns) { ActiveAdmin::Namespace.new(app, "Admin") } let(:post_resource) { ns.register Post } it "should be disabled globally by default" do # Note: the default initi...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/batch_actions/resource_spec.rb
spec/unit/batch_actions/resource_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::BatchActions::ResourceExtension do let(:resource) do namespace = ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin) namespace.batch_actions = true namespace.register(Post) end describe "default action" do ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/resource/ordering_spec.rb
spec/unit/resource/ordering_spec.rb
# frozen_string_literal: true require "rails_helper" module ActiveAdmin RSpec.describe Resource, "Ordering" do describe "#order_by" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new application, :admin } let(:resource_config) { ActiveAdmin::Resou...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/resource/action_items_spec.rb
spec/unit/resource/action_items_spec.rb
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Resource::ActionItems do let(:resource) do namespace = ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin) namespace.register(Post) end describe "adding a new action item" do before do resource.clear_...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin/blob/b9d630ce22a739d57c9c8b9976807a370e4de140/spec/unit/resource/naming_spec.rb
spec/unit/resource/naming_spec.rb
# frozen_string_literal: true require "rails_helper" module ActiveAdmin RSpec.describe Resource, "Naming" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { Namespace.new(application, :admin) } def config(options = {}) @config ||= Resource.new(namespace, Category, options) ...
ruby
MIT
b9d630ce22a739d57c9c8b9976807a370e4de140
2026-01-04T15:38:25.641812Z
false