source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/spec_helper.rb
Ruby
mit
9,684
master
575
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/rails_helper.rb
Ruby
mit
9,684
master
853
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/tasks/local_spec.rb
Ruby
mit
9,684
master
239
# 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
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/tasks/gemfile_spec.rb
Ruby
mit
9,684
master
1,544
# frozen_string_literal: true RSpec.describe "Gemfile sanity" do # Strips the BUNDLED WITH section from a Gemfile.lock content string. # This section only contains the Bundler version used and can differ between environments # without affecting the actual dependency resolution. # # Handles various edge cases:...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/locales/i18n_spec.rb
Ruby
mit
9,684
master
1,810
# 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_...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/helpers/form_helper_spec.rb
Ruby
mit
9,684
master
3,711
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/helpers/display_helper_spec.rb
Ruby
mit
9,684
master
11,543
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/helpers/filter_form_helper_spec.rb
Ruby
mit
9,684
master
20,321
# 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(...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/helpers/breadcrumb_helper_spec.rb
Ruby
mit
9,684
master
9,178
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/helpers/auto_link_helper_spec.rb
Ruby
mit
9,684
master
2,712
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/helpers/index_helper_spec.rb
Ruby
mit
9,684
master
2,441
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/helpers/layout_helper_spec.rb
Ruby
mit
9,684
master
2,187
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/requests/default_namespace_spec.rb
Ruby
mit
9,684
master
2,223
# 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) {...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/requests/memory_spec.rb
Ruby
mit
9,684
master
686
# 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:...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/active_admin_integration_spec_helper.rb
Ruby
mit
9,684
master
3,154
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/active_support_deprecation.rb
Ruby
mit
9,684
master
558
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/rails_template.rb
Ruby
mit
9,684
master
6,163
# frozen_string_literal: true # Rails template to build the sample app for specs gem "cssbundling-rails" # Manifest already exists in Rails 7.2 create_file "app/assets/config/manifest.js", skip: true rails_command "css:install:tailwind" # Remove default configuration generated: https://github.com/rails/cssbundling-r...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/rails_template_with_data.rb
Ruby
mit
9,684
master
3,108
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates/post_decorator.rb
Ruby
mit
9,684
master
550
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates/post_poro_decorator.rb
Ruby
mit
9,684
master
247
# 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
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates/admin/companies.rb
Ruby
mit
9,684
master
292
# 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
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates/models/user.rb
Ruby
mit
9,684
master
526
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates/models/post.rb
Ruby
mit
9,684
master
885
# 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_...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates/models/category.rb
Ruby
mit
9,684
master
231
# 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
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates/models/blog/post.rb
Ruby
mit
9,684
master
293
# 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
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates/policies/application_policy.rb
Ruby
mit
9,684
master
670
# 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? ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates/policies/post_policy.rb
Ruby
mit
9,684
master
258
# 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
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates/policies/active_admin/page_policy.rb
Ruby
mit
9,684
master
214
# frozen_string_literal: true module ActiveAdmin class PagePolicy < ApplicationPolicy def show? case record.name when "Dashboard" true else false end end end end
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates/policies/active_admin/comment_policy.rb
Ruby
mit
9,684
master
268
# 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
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates_with_data/admin/users.rb
Ruby
mit
9,684
master
1,616
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates_with_data/admin/kitchen_sink.rb
Ruby
mit
9,684
master
5,374
# 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 "...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates_with_data/admin/posts.rb
Ruby
mit
9,684
master
4,183
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates_with_data/admin/tags.rb
Ruby
mit
9,684
master
281
# 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
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/templates_with_data/admin/components/custom_index.rb
Ruby
mit
9,684
master
669
# 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 ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/shared_contexts/capture_stderr.rb
Ruby
mit
9,684
master
207
# 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
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/support/matchers/perform_database_query_matcher.rb
Ruby
mit
9,684
master
713
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/page_spec.rb
Ruby
mit
9,684
master
3,787
# 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)...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/settings_node_spec.rb
Ruby
mit
9,684
master
628
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/form_builder_spec.rb
Ruby
mit
9,684
master
31,328
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/component_spec.rb
Ruby
mit
9,684
master
538
# 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 ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/collection_decorator_spec.rb
Ruby
mit
9,684
master
786
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/comments_spec.rb
Ruby
mit
9,684
master
7,760
# 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!...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/devise_spec.rb
Ruby
mit
9,684
master
2,264
# 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) {...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/dynamic_settings_spec.rb
Ruby
mit
9,684
master
808
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/active_admin_spec.rb
Ruby
mit
9,684
master
306
# 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
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/csv_builder_spec.rb
Ruby
mit
9,684
master
9,175
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource_registration_spec.rb
Ruby
mit
9,684
master
2,527
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/menu_spec.rb
Ruby
mit
9,684
master
2,290
# 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 ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/order_clause_spec.rb
Ruby
mit
9,684
master
2,038
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/async_count_spec.rb
Ruby
mit
9,684
master
1,999
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/menu_collection_spec.rb
Ruby
mit
9,684
master
1,448
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/config_shared_examples.rb
Ruby
mit
9,684
master
1,651
# 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_...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource_controller_spec.rb
Ruby
mit
9,684
master
11,066
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/cancan_adapter_spec.rb
Ruby
mit
9,684
master
1,364
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/action_builder_spec.rb
Ruby
mit
9,684
master
3,996
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/belongs_to_spec.rb
Ruby
mit
9,684
master
2,452
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/controller_filters_spec.rb
Ruby
mit
9,684
master
1,034
# 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::...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource_spec.rb
Ruby
mit
9,684
master
11,095
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/dsl_spec.rb
Ruby
mit
9,684
master
2,766
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/namespace_spec.rb
Ruby
mit
9,684
master
2,978
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/routing_spec.rb
Ruby
mit
9,684
master
6,311
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource_collection_spec.rb
Ruby
mit
9,684
master
5,468
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/dependency_spec.rb
Ruby
mit
9,684
master
4,909
# 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....
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/menu_item_spec.rb
Ruby
mit
9,684
master
2,207
# 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" ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/pundit_adapter_spec.rb
Ruby
mit
9,684
master
6,467
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/application_spec.rb
Ruby
mit
9,684
master
5,114
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/scope_spec.rb
Ruby
mit
9,684
master
7,057
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/generators/install_spec.rb
Ruby
mit
9,684
master
577
# frozen_string_literal: true require "rails_helper" RSpec.describe "ActiveAdmin Installation" do it "creates active_admin.css" do expect(Rails.root.join("app/assets/stylesheets/active_admin.css")).to exist end it "creates tailwind config file" do expect(Rails.root.join("tailwind-active_admin.config.js"...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/authorization/index_overriding_spec.rb
Ruby
mit
9,684
master
530
# frozen_string_literal: true require "rails_helper" RSpec.describe "Index overriding", type: :controller do before do load_resources { ActiveAdmin.register Post } @controller = Admin::PostsController.new @controller.instance_eval do def index super do render body: "Rendered from...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/authorization/authorization_adapter_spec.rb
Ruby
mit
9,684
master
1,390
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::AuthorizationAdapter do let(:adapter) { ActiveAdmin::AuthorizationAdapter.new(double, double) } describe "#authorized?" do it "should always return true" do expect(adapter.authorized?(:read, "Resource")).to eq true end ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/authorization/controller_authorization_spec.rb
Ruby
mit
9,684
master
1,299
# frozen_string_literal: true require "rails_helper" RSpec.describe "Controller Authorization", type: :controller do let(:authorization) { controller.send(:active_admin_authorization) } before do load_resources { ActiveAdmin.register Post } @controller = Admin::PostsController.new allow(authorization)...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource/ordering_spec.rb
Ruby
mit
9,684
master
1,002
# 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...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource/includes_spec.rb
Ruby
mit
9,684
master
641
# frozen_string_literal: true require "rails_helper" module ActiveAdmin RSpec.describe Resource, "Includes" do describe "#includes" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new application, :admin } let(:resource_config) { ActiveAdmin::Resou...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource/scopes_spec.rb
Ruby
mit
9,684
master
1,498
# frozen_string_literal: true require "rails_helper" module ActiveAdmin RSpec.describe Resource, "Scopes" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { Namespace.new(application, :admin) } def config(options = {}) @config ||= Resource.new(namespace, Category, options) ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource/sidebars_spec.rb
Ruby
mit
9,684
master
1,130
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Resource::Sidebars do let(:resource) do namespace = ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin) namespace.register(Post) end let(:sidebar) { ActiveAdmin::SidebarSection.new(:help) } describe "adding ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource/attributes_spec.rb
Ruby
mit
9,684
master
2,239
# frozen_string_literal: true require "rails_helper" module ActiveAdmin RSpec.describe Resource, "Attributes" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new application, :admin } let(:resource_config) { ActiveAdmin::Resource.new namespace, Post } d...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource/page_presenters_spec.rb
Ruby
mit
9,684
master
1,504
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Resource::PagePresenters do let(:namespace) { ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin) } let(:resource) { namespace.register(Post) } it "should have an empty set of configs on initialize" do expect(resou...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource/action_items_spec.rb
Ruby
mit
9,684
master
2,030
# 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_...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource/comments_spec.rb
Ruby
mit
9,684
master
1,615
# frozen_string_literal: true require "rails_helper" RSpec.describe "ActiveAdmin Comments", type: :controller do before do load_resources { ActiveAdmin.register ActiveAdmin::Comment, as: "Comment" } @controller = Admin::CommentsController.new end describe "#destroy" do let(:user) { User.create! } ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource/naming_spec.rb
Ruby
mit
9,684
master
4,300
# 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) ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource/pagination_spec.rb
Ruby
mit
9,684
master
923
# frozen_string_literal: true require "rails_helper" module ActiveAdmin RSpec.describe Resource, "Pagination" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { Namespace.new(application, :admin) } def config(options = {}) @config ||= Resource.new(namespace, Category, options)...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource/routes_spec.rb
Ruby
mit
9,684
master
3,972
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Resource::Routes do let(:application) { ActiveAdmin.application } let(:namespace) { application.namespace(:admin) } context "when in the admin namespace" do let(:config) { namespace.resource_for("Category") } around do |ex...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/view_helpers/method_or_proc_helper_spec.rb
Ruby
mit
9,684
master
3,987
# frozen_string_literal: true require "rails_helper" RSpec.describe MethodOrProcHelper do let(:receiver) { double } let(:context) do obj = double receiver_in_context: receiver obj.extend described_class obj end describe "#call_method_or_exec_proc" do it "should call the method in the context ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/views/components/index_list_spec.rb
Ruby
mit
9,684
master
2,074
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Views::IndexList do let(:custom_index_as) do Class.new(ActiveAdmin::Component) do def build(page_presenter, collection) add_class "index" resource_selection_toggle_panel if active_admin_config.batch_actions.any...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/views/components/paginated_collection_spec.rb
Ruby
mit
9,684
master
12,404
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Views::PaginatedCollection do describe "creating with the dsl" do around do |example| with_resources_during(example) { ActiveAdmin.register Post } end let(:view) do view = mock_action_view allow(view.reque...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/views/components/panel_spec.rb
Ruby
mit
9,684
master
1,281
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Views::Panel do let(:arbre_panel) do render_arbre_component do panel "My Title" do span("Hello World") end end end let(:panel_html) { Capybara.string(arbre_panel.to_s) } it "should have a title h3" do...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/views/components/scopes_spec.rb
Ruby
mit
9,684
master
4,419
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Views::Scopes do describe "the scopes list" do let(:collection) { Post.all } let(:active_admin_config) { ActiveAdmin.register(Post) } let(:assigns) do { active_admin_config: active_admin_config, collec...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/views/components/status_tag_spec.rb
Ruby
mit
9,684
master
7,879
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Views::StatusTag do # Helper method to build StatusTag objects in an Arbre context def status_tag(*args) render_arbre_component(status_tag_args: args) do status_tag(*assigns[:status_tag_args]) end end describe "#tag...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/views/components/attributes_table_spec.rb
Ruby
mit
9,684
master
9,703
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Views::AttributesTable do describe "creating with the dsl" do let(:helpers) { mock_action_view } let(:post) do post = Post.new title: "Hello World", body: nil allow(post).to receive(:id) { 1 } allow(post).to r...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/views/components/table_for_spec.rb
Ruby
mit
9,684
master
16,352
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Views::TableFor do describe "creating with the dsl" do let(:collection) do [ Post.new(title: "First Post", starred: true), Post.new(title: "Second Post"), Post.new(title: "Third Post", starred: false) ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/views/components/index_table_for_spec.rb
Ruby
mit
9,684
master
3,199
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Views::IndexAsTable::IndexTableFor do describe "creating with the dsl" do let(:collection) do [Post.new(title: "First Post", starred: true)] end let(:active_admin_config) do namespace = ActiveAdmin::Namespace.new...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource_controller/decorators_spec.rb
Ruby
mit
9,684
master
3,126
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::ResourceController::Decorators do describe "#apply_decorator" do let(:resource) { Post.new } let(:controller) { controller_with_decorator(action, decorator_class) } subject(:applied) { controller.apply_decorator(resource) } ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource_controller/data_access_spec.rb
Ruby
mit
9,684
master
8,489
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::ResourceController::DataAccess do around do |example| with_resources_during(example) do config end end let(:config) do ActiveAdmin.register Post do end end let(:http_params) do {} end let(:params...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/resource_controller/polymorphic_routes_spec.rb
Ruby
mit
9,684
master
3,578
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::ResourceController::PolymorphicRoutes, type: :controller do let(:klass) { Admin::PostsController } %w(polymorphic_url polymorphic_path).each do |method| describe method do let(:add_extra_routes) {} let(:params) { {} }...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/namespace/authorization_spec.rb
Ruby
mit
9,684
master
831
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Resource, "authorization" do let(:app) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new(app, :admin) } let(:auth) { double } describe "authorization_adapter" do it "should return AuthorizationAdap...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/namespace/register_page_spec.rb
Ruby
mit
9,684
master
2,537
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Namespace, "registering a page" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new(application, :admin) } let(:menu) { namespace.fetch_menu(:default) } context "with no configuratio...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/namespace/register_resource_spec.rb
Ruby
mit
9,684
master
5,379
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Namespace, "registering a resource" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new(application, :super_admin) } let(:menu) { namespace.fetch_menu(:default) } after { namespace.u...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/helpers/scope_chain_spec.rb
Ruby
mit
9,684
master
1,055
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::ScopeChain do include ActiveAdmin::ScopeChain describe "#scope_chain" do let(:relation) { double } context "when Scope has a scope method" do let(:scope) { ActiveAdmin::Scope.new :published } it "should call the...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/filters/active_spec.rb
Ruby
mit
9,684
master
515
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Filters::Active do let(:resource) do namespace = ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin) namespace.register(Post) end subject { described_class.new(resource, search) } let(:params) do ::Actio...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
spec/unit/filters/resource_spec.rb
Ruby
mit
9,684
master
4,462
# frozen_string_literal: true require "rails_helper" RSpec.describe ActiveAdmin::Filters::ResourceExtension do let(:resource) do namespace = ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin) namespace.register(Post) end it "should return a Hash" do expect(resource.filters).to be_a Has...