From 124c163f264a37fb8789985cd73783072278687e Mon Sep 17 00:00:00 2001 From: Igor Fedoronchuk Date: Sat, 18 Feb 2017 01:03:24 +0200 Subject: [PATCH] configure rspec with disable_monkey_patching! see https://www.relishapp.com/rspec/rspec-core/v/3-0/docs/configuration/zero-monkey-patching-mode disable all monkey patching done by RSpec --- spec/bug_report_templates_spec.rb | 2 +- spec/rails_helper.rb | 5 +- spec/requests/default_namespace_spec.rb | 6 +- spec/requests/javascript_spec.rb | 2 +- spec/requests/memory_spec.rb | 2 +- spec/requests/stylesheets_spec.rb | 2 +- spec/support/active_admin_request_helpers.rb | 4 +- spec/unit/abstract_view_factory_spec.rb | 10 +-- spec/unit/action_builder_spec.rb | 8 +- spec/unit/active_admin_spec.rb | 2 +- spec/unit/application_spec.rb | 12 +-- spec/unit/asset_registration_spec.rb | 2 +- .../authorization_adapter_spec.rb | 8 +- .../controller_authorization_spec.rb | 2 +- .../authorization/index_overriding_spec.rb | 2 +- spec/unit/auto_link_spec.rb | 2 +- spec/unit/batch_actions/resource_spec.rb | 12 +-- spec/unit/batch_actions/settings_spec.rb | 2 +- spec/unit/belongs_to_spec.rb | 6 +- spec/unit/cancan_adapter_spec.rb | 4 +- spec/unit/comments_spec.rb | 22 +++--- spec/unit/component_spec.rb | 2 +- spec/unit/config_shared_examples.rb | 12 +-- spec/unit/controller_filters_spec.rb | 2 +- spec/unit/csv_builder_spec.rb | 14 ++-- spec/unit/dependency_spec.rb | 12 +-- spec/unit/devise_spec.rb | 10 +-- spec/unit/dsl_spec.rb | 14 ++-- spec/unit/filters/active_spec.rb | 6 +- spec/unit/filters/filter_form_builder_spec.rb | 38 ++++----- spec/unit/filters/humanized_spec.rb | 6 +- spec/unit/filters/resource_spec.rb | 8 +- spec/unit/form_builder_spec.rb | 30 +++---- spec/unit/generators/install_spec.rb | 2 +- spec/unit/helpers/collection_spec.rb | 6 +- spec/unit/helpers/scope_chain_spec.rb | 4 +- spec/unit/helpers/settings_spec.rb | 2 +- spec/unit/i18n_spec.rb | 2 +- .../localizers/resource_localizer_spec.rb | 4 +- spec/unit/menu_collection_spec.rb | 8 +- spec/unit/menu_item_spec.rb | 6 +- spec/unit/menu_spec.rb | 6 +- spec/unit/namespace/authorization_spec.rb | 4 +- spec/unit/namespace/register_page_spec.rb | 18 ++--- spec/unit/namespace/register_resource_spec.rb | 30 +++---- spec/unit/namespace_spec.rb | 10 +-- spec/unit/order_clause_spec.rb | 26 +++---- spec/unit/page_controller_spec.rb | 2 +- spec/unit/page_spec.rb | 14 ++-- spec/unit/pretty_format_spec.rb | 2 +- spec/unit/pundit_adapter_spec.rb | 6 +- spec/unit/resource/action_items_spec.rb | 8 +- spec/unit/resource/includes_spec.rb | 4 +- spec/unit/resource/menu_spec.rb | 2 +- spec/unit/resource/naming_spec.rb | 20 ++--- spec/unit/resource/ordering_spec.rb | 4 +- spec/unit/resource/page_presenters_spec.rb | 4 +- spec/unit/resource/pagination_spec.rb | 6 +- spec/unit/resource/routes_spec.rb | 4 +- spec/unit/resource/scopes_spec.rb | 4 +- spec/unit/resource/sidebars_spec.rb | 6 +- spec/unit/resource_collection_spec.rb | 8 +- .../resource_controller/data_access_spec.rb | 14 ++-- .../resource_controller/decorators_spec.rb | 8 +- .../unit/resource_controller/sidebars_spec.rb | 6 +- spec/unit/resource_controller_spec.rb | 28 +++---- spec/unit/resource_registration_spec.rb | 2 +- spec/unit/resource_spec.rb | 30 +++---- spec/unit/routing_spec.rb | 14 ++-- spec/unit/scope_spec.rb | 56 ++++++------- spec/unit/settings_spec.rb | 18 ++--- spec/unit/view_factory_spec.rb | 2 +- spec/unit/view_helpers/breadcrumbs_spec.rb | 4 +- spec/unit/view_helpers/display_helper_spec.rb | 6 +- .../download_format_links_helper_spec.rb | 4 +- spec/unit/view_helpers/fields_for_spec.rb | 2 +- spec/unit/view_helpers/flash_helper_spec.rb | 4 +- spec/unit/view_helpers/form_helper_spec.rb | 6 +- .../method_or_proc_helper_spec.rb | 10 +-- .../views/components/attributes_table_spec.rb | 16 ++-- .../components/batch_action_selector_spec.rb | 12 +-- .../unit/views/components/blank_slate_spec.rb | 10 +-- spec/unit/views/components/columns_spec.rb | 16 ++-- spec/unit/views/components/index_list_spec.rb | 6 +- .../views/components/index_table_for_spec.rb | 4 +- .../components/paginated_collection_spec.rb | 8 +- spec/unit/views/components/panel_spec.rb | 4 +- .../views/components/sidebar_section_spec.rb | 2 +- spec/unit/views/components/site_title_spec.rb | 2 +- spec/unit/views/components/status_tag_spec.rb | 78 +++++++++---------- spec/unit/views/components/table_for_spec.rb | 14 ++-- spec/unit/views/components/tabs_spec.rb | 4 +- .../components/unsupported_browser_spec.rb | 4 +- spec/unit/views/index_as_blog_spec.rb | 12 +-- spec/unit/views/pages/form_spec.rb | 4 +- spec/unit/views/pages/index_spec.rb | 4 +- spec/unit/views/pages/layout_spec.rb | 4 +- spec/unit/views/pages/show_spec.rb | 4 +- spec/unit/views/tabbed_navigation_spec.rb | 8 +- 99 files changed, 462 insertions(+), 461 deletions(-) diff --git a/spec/bug_report_templates_spec.rb b/spec/bug_report_templates_spec.rb index ef3abc34ce8..316831f2999 100644 --- a/spec/bug_report_templates_spec.rb +++ b/spec/bug_report_templates_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'bug_report_templates' do +RSpec.describe 'bug_report_templates' do subject do Bundler.with_clean_env do Dir.chdir(chdir_path) do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index afa7824460d..15172c4a537 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -84,9 +84,9 @@ def with_translation(translation) require ENV['RAILS_ROOT'] + '/config/environment' -require 'rspec/rails' +require 'RSpec.rails' -# Prevent Test::Unit's AutoRunner from executing during RSpec's rake task on +# Prevent Test::Unit's AutoRunner from executing during RSpec.s rake task on # JRuby Test::Unit.run = true if defined?(Test::Unit) && Test::Unit.respond_to?(:run=) @@ -101,6 +101,7 @@ def with_translation(translation) ActiveAdmin.application.current_user_method = false RSpec.configure do |config| + config.disable_monkey_patching! config.use_transactional_fixtures = true config.use_instantiated_fixtures = false config.render_views = false diff --git a/spec/requests/default_namespace_spec.rb b/spec/requests/default_namespace_spec.rb index e9d618742d0..a0d38786b1b 100644 --- a/spec/requests/default_namespace_spec.rb +++ b/spec/requests/default_namespace_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' -describe ActiveAdmin::Application, type: :request do +RSpec.describe ActiveAdmin::Application, type: :request do include Rails.application.routes.url_helpers [false, nil].each do |value| - describe "with a #{value} default namespace" do + RSpec.describe "with a #{value} default namespace" do before(:all) do @__original_application = ActiveAdmin.application @@ -33,7 +33,7 @@ end - describe "with a test default namespace" do + RSpec.describe "with a test default namespace" do before(:all) do @__original_application = ActiveAdmin.application diff --git a/spec/requests/javascript_spec.rb b/spec/requests/javascript_spec.rb index 8d41b4edb95..d0c2bd4597a 100644 --- a/spec/requests/javascript_spec.rb +++ b/spec/requests/javascript_spec.rb @@ -7,7 +7,7 @@ RbConfig::CONFIG['host_os'].include?('darwin') ? `/usr/libexec/java_home` : `which java` java_installed = $?.success? -describe 'Javascript', type: :request, if: java_installed do +RSpec.describe 'Javascript', type: :request, if: java_installed do let(:lint) { JSLint::Lint.new \ paths: ['public/javascripts/**/*.js'], diff --git a/spec/requests/memory_spec.rb b/spec/requests/memory_spec.rb index 4594f513f85..755d385b3fc 100644 --- a/spec/requests/memory_spec.rb +++ b/spec/requests/memory_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "Memory Leak", type: :request, if: RUBY_ENGINE == 'ruby' do +RSpec.describe "Memory Leak", type: :request, if: RUBY_ENGINE == 'ruby' do def count_instances_of(klass) ObjectSpace.each_object(klass) { } end diff --git a/spec/requests/stylesheets_spec.rb b/spec/requests/stylesheets_spec.rb index 1fea493c1a9..f008baa8b5b 100644 --- a/spec/requests/stylesheets_spec.rb +++ b/spec/requests/stylesheets_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "Stylesheets", type: :request do +RSpec.describe "Stylesheets", type: :request do require "sprockets" diff --git a/spec/support/active_admin_request_helpers.rb b/spec/support/active_admin_request_helpers.rb index 383f4bf26a8..d1e48803f31 100644 --- a/spec/support/active_admin_request_helpers.rb +++ b/spec/support/active_admin_request_helpers.rb @@ -6,10 +6,10 @@ module ActiveAdminRequestHelpers extend ActiveSupport::Concern include ActionDispatch::Integration::Runner - include RSpec::Rails::TestUnitAssertionAdapter + include RSpec.:Rails::TestUnitAssertionAdapter include ActionDispatch::Assertions include Capybara::DSL - include RSpec::Matchers + include RSpec.:Matchers def app ::Rails.application diff --git a/spec/unit/abstract_view_factory_spec.rb b/spec/unit/abstract_view_factory_spec.rb index 8a9bb0c9b8b..033364dd653 100644 --- a/spec/unit/abstract_view_factory_spec.rb +++ b/spec/unit/abstract_view_factory_spec.rb @@ -2,12 +2,12 @@ require 'active_admin/abstract_view_factory' -describe ActiveAdmin::AbstractViewFactory do +RSpec.describe ActiveAdmin::AbstractViewFactory do let(:view_factory){ ActiveAdmin::AbstractViewFactory.new } let(:view){ Class.new } - describe "registering a new view key" do + RSpec.describe "registering a new view key" do before do view_factory.register my_new_view_class: view end @@ -30,7 +30,7 @@ end end - describe "array syntax access" do + RSpec.describe "array syntax access" do before do view_factory.register my_new_view_class: view end @@ -45,7 +45,7 @@ end end - describe "registering default views" do + RSpec.describe "registering default views" do before do ActiveAdmin::AbstractViewFactory.register my_default_view_class: view end @@ -59,7 +59,7 @@ end end - describe "subclassing the ViewFactory" do + RSpec.describe "subclassing the ViewFactory" do let(:subclass) do ActiveAdmin::AbstractViewFactory.register my_subclassed_view: "From Parent" Class.new(ActiveAdmin::AbstractViewFactory) do diff --git a/spec/unit/action_builder_spec.rb b/spec/unit/action_builder_spec.rb index 8c29de44ad1..491c25c5be4 100644 --- a/spec/unit/action_builder_spec.rb +++ b/spec/unit/action_builder_spec.rb @@ -1,14 +1,14 @@ require 'rails_helper' -describe 'defining actions from registration blocks', type: :controller do +RSpec.describe 'defining actions from registration blocks', type: :controller do let(:klass){ Admin::PostsController } - render_views # https://github.com/rspec/rspec-rails/issues/860 + render_views # https://github.com/RSpec.RSpec.rails/issues/860 before do @controller = klass.new end - describe 'creates a member action' do + RSpec.describe 'creates a member action' do before do action! reload_routes! @@ -71,7 +71,7 @@ end end - describe 'creates a collection action' do + RSpec.describe 'creates a collection action' do before do action! reload_routes! diff --git a/spec/unit/active_admin_spec.rb b/spec/unit/active_admin_spec.rb index 326c2da2f70..e1ec9ea035c 100644 --- a/spec/unit/active_admin_spec.rb +++ b/spec/unit/active_admin_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin do +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) diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index 7a0aae7ac14..b17f823764b 100644 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -1,11 +1,11 @@ require 'rails_helper' require 'fileutils' -describe ActiveAdmin::Application do +RSpec.describe ActiveAdmin::Application do let(:application) do ActiveAdmin::Application.new.tap do |app| - # Manually override the load paths becuase RSpec messes these up + # Manually override the load paths becuase RSpec.messes these up app.load_paths = [File.expand_path('app/admin', Rails.root)] end end @@ -95,7 +95,7 @@ expect(application.order_clause).to eq ActiveAdmin::OrderClause end - describe "authentication settings" do + RSpec.describe "authentication settings" do it "should have no default current_user_method" do expect(application.current_user_method).to eq false @@ -114,7 +114,7 @@ end end - describe "files in load path" do + RSpec.describe "files in load path" do it "should load files in the first level directory" do expect(application.files).to include(File.expand_path("app/admin/dashboard.rb", Rails.root)) end @@ -127,7 +127,7 @@ end end - describe "#namespace" do + RSpec.describe "#namespace" do it "should yield a new namespace" do application.namespace :new_namespace do |ns| @@ -157,7 +157,7 @@ end end - describe "#register_page" do + RSpec.describe "#register_page" do it "finds or create the namespace and register the page to it" do namespace = double expect(application).to receive(:namespace).with("public").and_return namespace diff --git a/spec/unit/asset_registration_spec.rb b/spec/unit/asset_registration_spec.rb index 441c8d999db..740a4ddd3ba 100644 --- a/spec/unit/asset_registration_spec.rb +++ b/spec/unit/asset_registration_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::AssetRegistration do +RSpec.describe ActiveAdmin::AssetRegistration do include ActiveAdmin::AssetRegistration before do diff --git a/spec/unit/authorization/authorization_adapter_spec.rb b/spec/unit/authorization/authorization_adapter_spec.rb index 17c3a075781..042d81cb4d2 100644 --- a/spec/unit/authorization/authorization_adapter_spec.rb +++ b/spec/unit/authorization/authorization_adapter_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' -describe ActiveAdmin::AuthorizationAdapter do +RSpec.describe ActiveAdmin::AuthorizationAdapter do let(:adapter) { ActiveAdmin::AuthorizationAdapter.new(double, double) } - describe "#authorized?" do + RSpec.describe "#authorized?" do it "should always return true" do expect(adapter.authorized?(:read, "Resource")).to eq true @@ -12,7 +12,7 @@ end - describe "#scope_collection" do + RSpec.describe "#scope_collection" do it "should return the collection unscoped" do collection = double @@ -21,7 +21,7 @@ end - describe "using #normalized in a subclass" do + RSpec.describe "using #normalized in a subclass" do let(:auth_class) do Class.new(ActiveAdmin::AuthorizationAdapter) do diff --git a/spec/unit/authorization/controller_authorization_spec.rb b/spec/unit/authorization/controller_authorization_spec.rb index f8b05bb7c3f..c014229a07f 100644 --- a/spec/unit/authorization/controller_authorization_spec.rb +++ b/spec/unit/authorization/controller_authorization_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' Auth = ActiveAdmin::Authorization -describe Admin::PostsController, "Controller Authorization", type: :controller do +RSpec.describe Admin::PostsController, "Controller Authorization", type: :controller do let(:authorization){ controller.send(:active_admin_authorization) } diff --git a/spec/unit/authorization/index_overriding_spec.rb b/spec/unit/authorization/index_overriding_spec.rb index 40377284007..c1b57678cac 100644 --- a/spec/unit/authorization/index_overriding_spec.rb +++ b/spec/unit/authorization/index_overriding_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe Admin::PostsController, 'Index overriding', type: :controller do +RSpec.describe Admin::PostsController, 'Index overriding', type: :controller do before do controller.instance_eval do def index diff --git a/spec/unit/auto_link_spec.rb b/spec/unit/auto_link_spec.rb index 85ba0fb41d2..aea58f60f03 100644 --- a/spec/unit/auto_link_spec.rb +++ b/spec/unit/auto_link_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "auto linking resources" do +RSpec.describe "auto linking resources" do include ActiveAdmin::ViewHelpers::ActiveAdminApplicationHelper include ActiveAdmin::ViewHelpers::AutoLinkHelper include ActiveAdmin::ViewHelpers::DisplayHelper diff --git a/spec/unit/batch_actions/resource_spec.rb b/spec/unit/batch_actions/resource_spec.rb index 5fd3152b158..0f9efec6dc9 100644 --- a/spec/unit/batch_actions/resource_spec.rb +++ b/spec/unit/batch_actions/resource_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::BatchActions::ResourceExtension do +RSpec.describe ActiveAdmin::BatchActions::ResourceExtension do let(:resource) do namespace = ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin) @@ -8,7 +8,7 @@ namespace.register(Post) end - describe "default action" do + RSpec.describe "default action" do it "should have the default action by default" do expect(resource.batch_actions.size).to eq 1 @@ -17,7 +17,7 @@ end - describe "adding a new batch action" do + RSpec.describe "adding a new batch action" do before do resource.clear_batch_actions! @@ -40,7 +40,7 @@ end - describe "removing batch action" do + RSpec.describe "removing batch action" do before do resource.remove_batch_action :destroy @@ -52,7 +52,7 @@ end - describe "#display_if_block" do + RSpec.describe "#display_if_block" do it "should return true by default" do action = ActiveAdmin::BatchAction.new :default, "Default" @@ -66,7 +66,7 @@ end - describe "batch action priority" do + RSpec.describe "batch action priority" do it "should have a default priority" do action = ActiveAdmin::BatchAction.new :default, "Default" diff --git a/spec/unit/batch_actions/settings_spec.rb b/spec/unit/batch_actions/settings_spec.rb index 4cb186169cb..716c4d56b4e 100644 --- a/spec/unit/batch_actions/settings_spec.rb +++ b/spec/unit/batch_actions/settings_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "Batch Actions Settings" do +RSpec.describe "Batch Actions Settings" do let(:app) { ActiveAdmin::Application.new } let(:ns) { ActiveAdmin::Namespace.new(app, "Admin") } let(:post_resource) { ns.register Post } diff --git a/spec/unit/belongs_to_spec.rb b/spec/unit/belongs_to_spec.rb index d675c67b5af..0b06ecd9de3 100644 --- a/spec/unit/belongs_to_spec.rb +++ b/spec/unit/belongs_to_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Resource::BelongsTo do +RSpec.describe ActiveAdmin::Resource::BelongsTo do let(:user_config){ ActiveAdmin.register User } let(:post_config){ ActiveAdmin.register Post do belongs_to :user end } @@ -10,7 +10,7 @@ expect(belongs_to.owner).to eq post_config end - describe "finding the target" do + RSpec.describe "finding the target" do context "when the resource has been registered" do it "should return the target resource" do expect(belongs_to.target).to eq user_config @@ -47,7 +47,7 @@ class Blog::Author expect(belongs_to).to be_optional end - describe "controller" do + RSpec.describe "controller" do let(:controller) { post_config.controller.new } before do user = User.create! diff --git a/spec/unit/cancan_adapter_spec.rb b/spec/unit/cancan_adapter_spec.rb index 675af3df3cc..617546c5ca6 100644 --- a/spec/unit/cancan_adapter_spec.rb +++ b/spec/unit/cancan_adapter_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' -describe ActiveAdmin::CanCanAdapter do +RSpec.describe ActiveAdmin::CanCanAdapter do - describe "full integration" do + RSpec.describe "full integration" do let(:application){ ActiveAdmin::Application.new } let(:namespace){ ActiveAdmin::Namespace.new(application, "Admin") } diff --git a/spec/unit/comments_spec.rb b/spec/unit/comments_spec.rb index 0272181f95c..db99a4e3049 100644 --- a/spec/unit/comments_spec.rb +++ b/spec/unit/comments_spec.rb @@ -1,9 +1,9 @@ require 'rails_helper' -describe "Comments" do +RSpec.describe "Comments" do let(:application) { ActiveAdmin::Application.new } - describe ActiveAdmin::Comment do + RSpec.describe ActiveAdmin::Comment do subject(:comment){ ActiveAdmin::Comment.new } it "has valid Associations and Validations" do @@ -14,7 +14,7 @@ expect(comment).to validate_presence_of :namespace end - describe ".find_for_resource_in_namespace" do + RSpec.describe ".find_for_resource_in_namespace" do let(:post) { Post.create!(title: "Hello World") } let(:namespace_name) { "admin" } @@ -79,7 +79,7 @@ end end - describe ".resource_id_cast" do + RSpec.describe ".resource_id_cast" do let(:post) { Post.create!(title: "Testing.") } let(:namespace_name) { "admin" } @@ -91,7 +91,7 @@ end end - describe ".resource_type" do + RSpec.describe ".resource_type" do let(:post) { Post.create!(title: "Testing.") } let(:post_decorator) { double 'PostDecorator' } @@ -117,13 +117,13 @@ end end - describe ".resource_id_type" do + RSpec.describe ".resource_id_type" do it "should be :string" do expect(ActiveAdmin::Comment.resource_id_type).to eql :string end end - describe "Commenting on resource with string id" do + RSpec.describe "Commenting on resource with string id" do let(:tag) { Tag.create!(name: "cooltags") } let(:namespace_name) { "admin" } @@ -137,7 +137,7 @@ end end - describe "commenting on child of STI resource" do + RSpec.describe "commenting on child of STI resource" do let(:publisher) { Publisher.create!(username: "tenderlove") } let(:namespace_name) { "admin" } @@ -153,8 +153,8 @@ end end - describe ActiveAdmin::Comments::NamespaceHelper do - describe "#comments?" do + RSpec.describe ActiveAdmin::Comments::NamespaceHelper do + RSpec.describe "#comments?" do it "should have comments when the namespace allows comments" do ns = ActiveAdmin::Namespace.new(application, :admin) @@ -170,7 +170,7 @@ end end - describe ActiveAdmin::Comments::ResourceHelper do + RSpec.describe ActiveAdmin::Comments::ResourceHelper do it "should add an attr_accessor :comments to ActiveAdmin::Resource" do ns = ActiveAdmin::Namespace.new(application, :admin) resource = ActiveAdmin::Resource.new(ns, Post) diff --git a/spec/unit/component_spec.rb b/spec/unit/component_spec.rb index efeade7edaa..82a77ba5ced 100644 --- a/spec/unit/component_spec.rb +++ b/spec/unit/component_spec.rb @@ -2,7 +2,7 @@ class MockComponentClass < ActiveAdmin::Component; end -describe ActiveAdmin::Component do +RSpec.describe ActiveAdmin::Component do let(:component_class){ MockComponentClass } let(:component){ component_class.new } diff --git a/spec/unit/config_shared_examples.rb b/spec/unit/config_shared_examples.rb index 90317c18638..fc310f85194 100644 --- a/spec/unit/config_shared_examples.rb +++ b/spec/unit/config_shared_examples.rb @@ -1,11 +1,11 @@ shared_examples_for "ActiveAdmin::Resource" do - describe "namespace" do + RSpec.describe "namespace" do it "should return the namespace" do expect(config.namespace).to eq(namespace) end end - describe "page_presenters" do + RSpec.describe "page_presenters" do it "should return an empty hash by default" do expect(config.page_presenters).to eq({}) end @@ -20,7 +20,7 @@ it { respond_to :action_items? } it { respond_to :sidebar_sections? } - describe "Naming" do + RSpec.describe "Naming" do it "implements #resource_label" do expect { config.resource_label }.to_not raise_error end @@ -30,8 +30,8 @@ end end - describe "Menu" do - describe "#menu_item_options" do + RSpec.describe "Menu" do + RSpec.describe "#menu_item_options" do it "initializes a new menu item with defaults" do expect(config.menu_item_options[:label].call).to eq(config.plural_resource_label) @@ -44,7 +44,7 @@ end - describe "#include_in_menu?" do + RSpec.describe "#include_in_menu?" do it "should be included in menu by default" do expect(config.include_in_menu?).to eq(true) end diff --git a/spec/unit/controller_filters_spec.rb b/spec/unit/controller_filters_spec.rb index 28ed564a008..a7b828759be 100644 --- a/spec/unit/controller_filters_spec.rb +++ b/spec/unit/controller_filters_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Application do +RSpec.describe ActiveAdmin::Application do let(:application){ ActiveAdmin::Application.new } let(:controllers){ application.controllers_for_filters } diff --git a/spec/unit/csv_builder_spec.rb b/spec/unit/csv_builder_spec.rb index f554e888dd1..e01e75fe234 100644 --- a/spec/unit/csv_builder_spec.rb +++ b/spec/unit/csv_builder_spec.rb @@ -2,9 +2,9 @@ require 'rails_helper' -describe ActiveAdmin::CSVBuilder do +RSpec.describe ActiveAdmin::CSVBuilder do - describe '.default_for_resource using Post' do + RSpec.describe '.default_for_resource using Post' do let(:csv_builder) { ActiveAdmin::CSVBuilder.default_for_resource(Post).tap(&:exec_columns) } it 'returns a default csv_builder for Post' do @@ -57,7 +57,7 @@ expect(builder.columns.size).to eq 1 end - describe "the column" do + RSpec.describe "the column" do let(:column){ builder.columns.first } it "should have a name of 'Title'" do @@ -83,7 +83,7 @@ expect(builder.columns.size).to eq 1 end - describe "the column" do + RSpec.describe "the column" do let(:column){ builder.columns.first } it "should have a name of 'My title'" do @@ -104,7 +104,7 @@ end.tap(&:exec_columns) end - describe "the column" do + RSpec.describe "the column" do let(:column){ builder.columns.first } it "should have a name of 'my_title'" do @@ -120,7 +120,7 @@ end.tap(&:exec_columns) end - describe "the column" do + RSpec.describe "the column" do let(:column){ builder.columns.first } it "should have a name of 'my_title'" do @@ -147,7 +147,7 @@ end.tap(&:exec_columns) end - describe "the column" do + RSpec.describe "the column" do let(:column){ builder.columns.first } it "should have humanize_name option set" do diff --git a/spec/unit/dependency_spec.rb b/spec/unit/dependency_spec.rb index c0a798ebb84..6d9f52bfe3a 100644 --- a/spec/unit/dependency_spec.rb +++ b/spec/unit/dependency_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' -describe ActiveAdmin::Dependency do +RSpec.describe ActiveAdmin::Dependency do k = ActiveAdmin::Dependency - describe 'method_missing' do + RSpec.describe 'method_missing' do before do allow(Gem).to receive(:loaded_specs) .and_return 'foo' => Gem::Specification.new('foo', '1.2.3') @@ -16,7 +16,7 @@ expect(k.bar.inspect).to eq '' end - describe '`?`' do + RSpec.describe '`?`' do it 'base' do expect(k.foo?).to eq true expect(k.bar?).to eq false @@ -50,7 +50,7 @@ end end - describe '`!`' do + RSpec.describe '`!`' do it 'raises an error if requirement not met' do expect{ k.foo! '5' }.to raise_error ActiveAdmin::DependencyError, 'You provided foo 1.2.3 but we need: 5.' @@ -66,7 +66,7 @@ end end - describe '[]' do + RSpec.describe '[]' do before do allow(Gem).to receive(:loaded_specs) .and_return 'a-b' => Gem::Specification.new('a-b', '1.2.3') @@ -99,7 +99,7 @@ # Note: Ruby comparison operators are separate from the `foo? '> 1'` syntax - describe 'Ruby comparison syntax' do + RSpec.describe 'Ruby comparison syntax' do it '==' do expect(k['a-b'] == '1.2.3').to eq true diff --git a/spec/unit/devise_spec.rb b/spec/unit/devise_spec.rb index 9c8bff9da4f..1f9c1a1d76b 100644 --- a/spec/unit/devise_spec.rb +++ b/spec/unit/devise_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Devise::Controller do +RSpec.describe ActiveAdmin::Devise::Controller do let(:controller_class) do klass = Class.new do @@ -72,10 +72,10 @@ def self.helper(*); end end - describe "#config" do + RSpec.describe "#config" do let(:config) { ActiveAdmin::Devise.config } - describe ":sign_out_via option" do + RSpec.describe ":sign_out_via option" do it "should contain the application.logout_link_method" do expect(::Devise).to receive(:sign_out_via).and_return(:delete) expect(ActiveAdmin.application).to receive(:logout_link_method).and_return(:get) @@ -90,7 +90,7 @@ def self.helper(*); end expect(config[:sign_out_via]).to eq [:delete, :post, :get] end - end # describe ":sign_out_via option" - end # describe "#config" + end # RSpec.describe ":sign_out_via option" + end # RSpec.describe "#config" end diff --git a/spec/unit/dsl_spec.rb b/spec/unit/dsl_spec.rb index ec599efb3d2..77b4c8ded9f 100644 --- a/spec/unit/dsl_spec.rb +++ b/spec/unit/dsl_spec.rb @@ -6,14 +6,14 @@ def self.included(dsl) end end -describe ActiveAdmin::DSL do +RSpec.describe ActiveAdmin::DSL do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new application, :admin } let(:resource_config) { ActiveAdmin::Resource.new namespace, Post } let(:dsl){ ActiveAdmin::DSL.new(resource_config) } - describe "#include" do + RSpec.describe "#include" do it "should call the included class method on the module that is included" do expect(MockModuleToInclude).to receive(:included).with(dsl) @@ -25,7 +25,7 @@ def self.included(dsl) end - describe '#action_item' do + RSpec.describe '#action_item' do before do @default_items_count = resource_config.action_items.size @@ -57,7 +57,7 @@ def self.included(dsl) end end - describe "#menu" do + RSpec.describe "#menu" do it "should set the menu_item_options on the configuration" do expect(resource_config).to receive(:menu_item_options=).with({parent: "Admin"}) @@ -68,7 +68,7 @@ def self.included(dsl) end - describe "#navigation_menu" do + RSpec.describe "#navigation_menu" do it "should set the navigation_menu_name on the configuration" do expect(resource_config).to receive(:navigation_menu_name=).with(:admin) @@ -87,7 +87,7 @@ def self.included(dsl) end - describe "#sidebar" do + RSpec.describe "#sidebar" do before do dsl.config.sidebar_sections << ActiveAdmin::SidebarSection.new(:email) @@ -102,7 +102,7 @@ def self.included(dsl) end - describe "#batch_action" do + RSpec.describe "#batch_action" do it "should add a batch action by symbol" do dsl.run_registration_block do config.batch_actions = true diff --git a/spec/unit/filters/active_spec.rb b/spec/unit/filters/active_spec.rb index 1469fd01d3a..77434fc2c91 100644 --- a/spec/unit/filters/active_spec.rb +++ b/spec/unit/filters/active_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -describe ActiveAdmin::Filters::Active do - subject { described_class.new(Post, params) } +RSpec.describe ActiveAdmin::Filters::Active do + subject { RSpec.described_class.new(Post, params) } let(:params_klass) do if defined? ::ActionController::Parameters ::ActionController::Parameters @@ -18,4 +18,4 @@ expect(subject.filters.size).to eq(1) end -end \ No newline at end of file +end diff --git a/spec/unit/filters/filter_form_builder_spec.rb b/spec/unit/filters/filter_form_builder_spec.rb index 34f9585e6c5..92a1dc53513 100644 --- a/spec/unit/filters/filter_form_builder_spec.rb +++ b/spec/unit/filters/filter_form_builder_spec.rb @@ -12,7 +12,7 @@ class Post end end -describe ActiveAdmin::Filters::ViewHelper do +RSpec.describe ActiveAdmin::Filters::ViewHelper do # Setup an ActionView::Base object which can be used for # generating the form for. @@ -45,7 +45,7 @@ def filter(name, options = {}) let(:scope) { Post.search } - describe "the form in general" do + RSpec.describe "the form in general" do let(:body) { Capybara.string(filter :title) } it "should generate a form which submits via get" do @@ -64,7 +64,7 @@ def filter(name, options = {}) expect(body).to have_selector("a.clear_filters_btn", text: "Clear Filters") end - describe "label as proc" do + RSpec.describe "label as proc" do let(:body) { Capybara.string(filter :title, label: proc { 'Title from proc' }) } it "should render proper label" do @@ -73,7 +73,7 @@ def filter(name, options = {}) end end - describe "string attribute" do + RSpec.describe "string attribute" do let(:body) { Capybara.string(filter :title) } it "should generate a select option for starts with" do @@ -110,7 +110,7 @@ def filter(name, options = {}) context "with predicate" do %w[eq equals cont contains start starts_with end ends_with].each do |predicate| - describe "'#{predicate}'" do + RSpec.describe "'#{predicate}'" do let(:body) { Capybara.string(filter :"title_#{predicate}") } it "shouldn't include a select field" do @@ -125,7 +125,7 @@ def filter(name, options = {}) end end - describe "text attribute" do + RSpec.describe "text attribute" do let(:body) { Capybara.string(filter :body) } it "should generate a search field for a text attribute" do @@ -137,7 +137,7 @@ def filter(name, options = {}) end end - describe "string attribute, as a select" do + RSpec.describe "string attribute, as a select" do let(:body) { filter :title, as: :select } let(:builder) { ActiveAdmin::Inputs::Filters::SelectInput } @@ -159,7 +159,7 @@ def filter(name, options = {}) end end - describe "date attribute" do + RSpec.describe "date attribute" do let(:body) { Capybara.string(filter :published_date) } it "should generate a date greater than" do @@ -173,7 +173,7 @@ def filter(name, options = {}) end end - describe "datetime attribute" do + RSpec.describe "datetime attribute" do let(:body) { Capybara.string(filter :created_at) } it "should generate a date greater than" do @@ -187,7 +187,7 @@ def filter(name, options = {}) end end - describe "integer attribute" do + RSpec.describe "integer attribute" do let(:body) { Capybara.string(filter :id) } it "should generate a select option for equal to" do @@ -209,7 +209,7 @@ def filter(name, options = {}) end end - describe "boolean attribute" do + RSpec.describe "boolean attribute" do context "boolean datatypes" do let(:body) { Capybara.string(filter :starred) } @@ -247,7 +247,7 @@ def filter(name, options = {}) end end - describe "belongs_to" do + RSpec.describe "belongs_to" do before do @john = User.create first_name: "John", last_name: "Doe", username: "john_doe" @jane = User.create first_name: "Jane", last_name: "Doe", username: "jane_doe" @@ -321,11 +321,11 @@ def filter(name, options = {}) end end # belongs to - describe "has_and_belongs_to_many" do + RSpec.describe "has_and_belongs_to_many" do skip "add HABTM models so this can be tested" end - describe "has_many :through" do + RSpec.describe "has_many :through" do # Setup an ActionView::Base object which can be used for # generating the form for. let(:helpers) do @@ -376,7 +376,7 @@ def view.a_helper_method end end - describe "conditional display" do + RSpec.describe "conditional display" do [:if, :unless].each do |verb| should = verb == :if ? "should" : "shouldn't" if_true = verb == :if ? :to : :to_not @@ -407,7 +407,7 @@ def view.a_helper_method end end - describe "custom search methods" do + RSpec.describe "custom search methods" do it "should use the default type of the ransacker" do body = Capybara.string(filter :custom_searcher_numeric) @@ -427,7 +427,7 @@ def view.a_helper_method expect(body).to have_selector("option[value=custom_title_searcher_starts_with]") end - describe "custom date range search" do + RSpec.describe "custom date range search" do let(:qteq) { "2010-10-01" } let(:lteq) { "2010-10-02" } let(:scope){ Post.search custom_created_at_searcher_gteq_datetime: qteq, custom_created_at_searcher_lteq_datetime: lteq } @@ -451,14 +451,14 @@ def view.a_helper_method end end - describe "does not support some filter inputs" do + RSpec.describe "does not support some filter inputs" do it "should fallback to use formtastic inputs" do body = Capybara.string(filter :custom_title_searcher, as: :text) expect(body).to have_selector("textarea[name='q[custom_title_searcher]']") end end - describe "blank option" do + RSpec.describe "blank option" do context "for a select filter" do it "should be there by default" do body = Capybara.string(filter(:author)) diff --git a/spec/unit/filters/humanized_spec.rb b/spec/unit/filters/humanized_spec.rb index 043656b92b3..c92ab59acfc 100644 --- a/spec/unit/filters/humanized_spec.rb +++ b/spec/unit/filters/humanized_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -describe ActiveAdmin::Filters::Humanized do - describe '#value' do +RSpec.describe ActiveAdmin::Filters::Humanized do + RSpec.describe '#value' do it 'should equal query string parameter if not an Array' do param = ['category_id_eq', '1'] subject = ActiveAdmin::Filters::Humanized.new(param) @@ -21,7 +21,7 @@ end end - describe '#body' do + RSpec.describe '#body' do context 'when Ransack predicate' do it 'parses language from Ransack' do param = ['category_id_eq', '1'] diff --git a/spec/unit/filters/resource_spec.rb b/spec/unit/filters/resource_spec.rb index 6bc920de21f..68b470d5511 100644 --- a/spec/unit/filters/resource_spec.rb +++ b/spec/unit/filters/resource_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Filters::ResourceExtension do +RSpec.describe ActiveAdmin::Filters::ResourceExtension do let(:resource) do namespace = ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin) @@ -39,7 +39,7 @@ ]) end - describe "removing a filter" do + RSpec.describe "removing a filter" do it "should work" do expect(resource.filters.keys).to include :author resource.remove_filter :author @@ -68,7 +68,7 @@ end end - describe "removing a multiple filters inline" do + RSpec.describe "removing a multiple filters inline" do it "should work" do expect(resource.filters.keys).to include :author, :body resource.remove_filter :author, :body @@ -76,7 +76,7 @@ end end - describe "adding a filter" do + RSpec.describe "adding a filter" do it "should work" do resource.add_filter :title expect(resource.filters).to eq title: {} diff --git a/spec/unit/form_builder_spec.rb b/spec/unit/form_builder_spec.rb index 15b60699322..8db54708816 100644 --- a/spec/unit/form_builder_spec.rb +++ b/spec/unit/form_builder_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -require "rspec/mocks/standalone" +require "RSpec.mocks/standalone" -describe ActiveAdmin::FormBuilder do +RSpec.describe ActiveAdmin::FormBuilder do # Setup an ActionView::Base object which can be used for # generating the form for. let(:helpers) do @@ -123,7 +123,7 @@ def build_form(options = {}, form_object = Post.new, &block) end end - describe "passing in options with actions" do + RSpec.describe "passing in options with actions" do let :body do build_form html: { multipart: true } do |f| f.inputs :title @@ -260,7 +260,7 @@ def build_form(options = {}, form_object = Post.new, &block) User.create first_name: "Jane", last_name: "Doe" end - describe "as select" do + RSpec.describe "as select" do let :body do build_form do |f| f.input :author, include_blank: false @@ -271,7 +271,7 @@ def build_form(options = {}, form_object = Post.new, &block) end end - describe "as radio buttons" do + RSpec.describe "as radio buttons" do let :body do build_form do |f| f.input :author, as: :radio @@ -455,7 +455,7 @@ def user end context "with has many inputs" do - describe "with simple block" do + RSpec.describe "with simple block" do let :body do build_form({url: '/categories'}, Category.new) do |f| f.object.posts.build @@ -513,7 +513,7 @@ def user expect(link[:'data-placeholder']).to match valid_html_id end - describe "with namespaced model" do + RSpec.describe "with namespaced model" do it "should set an HTML-id valid placeholder" do allow(Post).to receive(:name).and_return "ActiveAdmin::Post" link = body.find('.has_many_container > a.button.has_many_add') @@ -522,7 +522,7 @@ def user end end - describe "with complex block" do + RSpec.describe "with complex block" do let :body do build_form({url: '/categories'}, Category.new) do |f| f.object.posts.build @@ -541,7 +541,7 @@ def user end end - describe "without heading and new record link" do + RSpec.describe "without heading and new record link" do let :body do build_form({url: '/categories'}, Category.new) do |f| f.object.posts.build @@ -564,7 +564,7 @@ def user end end - describe "with custom heading" do + RSpec.describe "with custom heading" do let :body do build_form({url: '/categories'}, Category.new) do |f| f.object.posts.build @@ -579,7 +579,7 @@ def user end end - describe "with custom new record link" do + RSpec.describe "with custom new record link" do let :body do build_form({url: '/categories'}, Category.new) do |f| f.object.posts.build @@ -594,7 +594,7 @@ def user end end - describe "with allow destroy" do + RSpec.describe "with allow destroy" do shared_examples_for "has many with allow_destroy = true" do |child_num| it "should render the nested form" do expect(body).to have_selector("input[name='category[posts_attributes][#{child_num}][title]']") @@ -754,7 +754,7 @@ def user end end - describe "sortable" do + RSpec.describe "sortable" do # TODO: it doesn't make any sense to use your foreign key as something that's sortable (and therefore editable) context "with a new post" do let :body do @@ -841,7 +841,7 @@ def user end end - describe "with nesting" do + RSpec.describe "with nesting" do context "in an inputs block" do let :body do build_form({url: '/categories'}, Category.new) do |f| @@ -926,7 +926,7 @@ def user end end - describe "datepicker input" do + RSpec.describe "datepicker input" do context 'with default options' do let :body do build_form do |f| diff --git a/spec/unit/generators/install_spec.rb b/spec/unit/generators/install_spec.rb index e1cdb69dc31..d1fbdb85b58 100644 --- a/spec/unit/generators/install_spec.rb +++ b/spec/unit/generators/install_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "AA installation" do +RSpec.describe "AA installation" do context "should create" do it "active_admin.scss" do diff --git a/spec/unit/helpers/collection_spec.rb b/spec/unit/helpers/collection_spec.rb index 30cc227f5c2..f990e17c833 100644 --- a/spec/unit/helpers/collection_spec.rb +++ b/spec/unit/helpers/collection_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Helpers::Collection do +RSpec.describe ActiveAdmin::Helpers::Collection do include ActiveAdmin::Helpers::Collection @@ -15,7 +15,7 @@ Post.delete_all end - describe "#collection_size" do + RSpec.describe "#collection_size" do it "should return the collection size for an ActiveRecord class" do expect(collection_size(Post.where(nil))).to eq 3 end @@ -51,7 +51,7 @@ def collection; Post.where(title: "A post").to_a end end end - describe "#collection_is_empty?" do + RSpec.describe "#collection_is_empty?" do it "should return true when the collection is empty" do expect(collection_is_empty?(Post.where(title: "Non existing post"))).to eq true end diff --git a/spec/unit/helpers/scope_chain_spec.rb b/spec/unit/helpers/scope_chain_spec.rb index 47f107f0e06..4f055afe515 100644 --- a/spec/unit/helpers/scope_chain_spec.rb +++ b/spec/unit/helpers/scope_chain_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' -describe ActiveAdmin::ScopeChain do +RSpec.describe ActiveAdmin::ScopeChain do include ActiveAdmin::ScopeChain - describe "#scope_chain" do + RSpec.describe "#scope_chain" do let(:relation) { double } context "when Scope has a scope method" do diff --git a/spec/unit/helpers/settings_spec.rb b/spec/unit/helpers/settings_spec.rb index aceea47dc5c..506d1bc65af 100644 --- a/spec/unit/helpers/settings_spec.rb +++ b/spec/unit/helpers/settings_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' require 'active_admin/helpers/settings' -describe ActiveAdmin::Settings do +RSpec.describe ActiveAdmin::Settings do # A Class with settings module included let(:klass) do diff --git a/spec/unit/i18n_spec.rb b/spec/unit/i18n_spec.rb index 0480e4f1f0e..1cadd8aa252 100644 --- a/spec/unit/i18n_spec.rb +++ b/spec/unit/i18n_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' Dir.glob('config/locales/*.yml') do |locale_file| - describe locale_file do + 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 } diff --git a/spec/unit/localizers/resource_localizer_spec.rb b/spec/unit/localizers/resource_localizer_spec.rb index cc696123cb8..abd256bb17a 100644 --- a/spec/unit/localizers/resource_localizer_spec.rb +++ b/spec/unit/localizers/resource_localizer_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' require File.expand_path('../config_shared_examples', File.dirname(__FILE__)) -describe ActiveAdmin::Localizers::ResourceLocalizer do +RSpec.describe ActiveAdmin::Localizers::ResourceLocalizer do let(:action) { 'new_model' } let(:model) { 'Comment' } let(:model_name) { 'comment' } @@ -10,7 +10,7 @@ let(:translation) { 'New Comment' } end - describe "model action specified" do + RSpec.describe "model action specified" do before do I18n.backend.store_translations :en, active_admin: {resources: {comment: {new_model: 'Write comment'}}} end diff --git a/spec/unit/menu_collection_spec.rb b/spec/unit/menu_collection_spec.rb index b01f4b95635..1ec8562d246 100644 --- a/spec/unit/menu_collection_spec.rb +++ b/spec/unit/menu_collection_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' -describe ActiveAdmin::MenuCollection do +RSpec.describe ActiveAdmin::MenuCollection do let(:menus) { ActiveAdmin::MenuCollection.new } - describe "#add" do + RSpec.describe "#add" do it "should initialize a new menu when first item" do menus.add :default, label: "Hello World" @@ -22,7 +22,7 @@ end - describe "#clear!" do + RSpec.describe "#clear!" do it "should remove all menus" do menus.add :default, label: "Hello World" @@ -37,7 +37,7 @@ end - describe "#on_build" do + RSpec.describe "#on_build" do it "runs a callback when fetching a menu" do menus.on_build do |m| diff --git a/spec/unit/menu_item_spec.rb b/spec/unit/menu_item_spec.rb index b8da10a353c..b23424c42d4 100644 --- a/spec/unit/menu_item_spec.rb +++ b/spec/unit/menu_item_spec.rb @@ -3,7 +3,7 @@ require 'active_admin/menu_item' module ActiveAdmin - describe MenuItem do + RSpec.describe MenuItem do it "should have a label" do item = MenuItem.new(label: "Dashboard") @@ -92,7 +92,7 @@ module ActiveAdmin end end - describe "accessing ancestory" do + RSpec.describe "accessing ancestory" do let(:item){ MenuItem.new label: "Blog" } context "with no parent" do @@ -129,7 +129,7 @@ module ActiveAdmin end # accessing ancestory - describe "#id" do + RSpec.describe "#id" do it "should be normalized" do expect(MenuItem.new(id: "Foo Bar").id).to eq "foo_bar" end diff --git a/spec/unit/menu_spec.rb b/spec/unit/menu_spec.rb index b553804e5c7..b427c3b90ab 100644 --- a/spec/unit/menu_spec.rb +++ b/spec/unit/menu_spec.rb @@ -4,7 +4,7 @@ include ActiveAdmin -describe ActiveAdmin::Menu do +RSpec.describe ActiveAdmin::Menu do context "with no items" do it "should have an empty item collection" do @@ -32,7 +32,7 @@ end end - describe "adding items with children" do + RSpec.describe "adding items with children" do it "should add an empty item if the parent does not exist" do menu = Menu.new menu.add parent: "Admin", label: "Users" @@ -58,7 +58,7 @@ end end - describe "sorting items" do + RSpec.describe "sorting items" do it "should sort children by the result of their label proc" do menu = Menu.new menu.add label: proc{ "G" }, id: "not related 1" diff --git a/spec/unit/namespace/authorization_spec.rb b/spec/unit/namespace/authorization_spec.rb index 445359f76f2..c1cace1f421 100644 --- a/spec/unit/namespace/authorization_spec.rb +++ b/spec/unit/namespace/authorization_spec.rb @@ -1,12 +1,12 @@ require 'rails_helper' -describe ActiveAdmin::Resource, "authorization" do +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 + RSpec.describe "authorization_adapter" do it "should return AuthorizationAdapter by default" do expect(app.authorization_adapter).to eq ActiveAdmin::AuthorizationAdapter diff --git a/spec/unit/namespace/register_page_spec.rb b/spec/unit/namespace/register_page_spec.rb index 2572037f414..99d8bd63522 100644 --- a/spec/unit/namespace/register_page_spec.rb +++ b/spec/unit/namespace/register_page_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Namespace, "registering a page" do +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) } @@ -31,8 +31,8 @@ end end - describe "adding to the menu" do - describe "adding as a top level item" do + RSpec.describe "adding to the menu" do + RSpec.describe "adding as a top level item" do before do namespace.register_page "Status" end @@ -42,7 +42,7 @@ end end - describe "adding as a child" do + RSpec.describe "adding as a child" do before do namespace.register_page "Status" do menu parent: 'Extra' @@ -58,7 +58,7 @@ end end - describe "disabling the menu" do + RSpec.describe "disabling the menu" do before do namespace.register_page "Status" do menu false @@ -68,10 +68,10 @@ it "should not create a menu item" do expect(menu["Status"]).to eq nil end - end # describe "disabling the menu" - end # describe "adding to the menu" + end # RSpec.describe "disabling the menu" + end # RSpec.describe "adding to the menu" - describe "adding as a belongs to" do + RSpec.describe "adding as a belongs to" do context "when not optional" do before do namespace.register_page "Reports" do @@ -95,5 +95,5 @@ expect(menu["Reports"]).to_not be_nil end end - end # describe "adding as a belongs to" + end # RSpec.describe "adding as a belongs to" end diff --git a/spec/unit/namespace/register_resource_spec.rb b/spec/unit/namespace/register_resource_spec.rb index 7f940b56884..c7a4ab9bfd2 100644 --- a/spec/unit/namespace/register_resource_spec.rb +++ b/spec/unit/namespace/register_resource_spec.rb @@ -3,7 +3,7 @@ # TODO: refactor this file so it doesn't depend on the Admin namespace in such a broken way. # Specifically, the dashboard is already defined. -describe ActiveAdmin::Namespace, "registering a resource" do +RSpec.describe ActiveAdmin::Namespace, "registering a resource" do let(:application){ ActiveAdmin::Application.new } let(:namespace){ ActiveAdmin::Namespace.new(application, :admin) } let(:menu){ namespace.fetch_menu(:default) } @@ -60,7 +60,7 @@ module ::Mock; class Resource; def self.has_many(arg1, arg2); end; end; end end end # context "with a resource that's namespaced" - describe "finding resource instances" do + RSpec.describe "finding resource instances" do it "should return the resource when its been registered" do post = namespace.register Post expect(namespace.resource_for(Post)).to eq post @@ -80,19 +80,19 @@ module ::Mock; class Resource; def self.has_many(arg1, arg2); end; end; end publisher = namespace.register Publisher expect(namespace.resource_for(Publisher)).to eq publisher end - end # describe "finding resource instances" + end # RSpec.describe "finding resource instances" - describe "adding to the menu" do - describe "adding as a top level item" do + RSpec.describe "adding to the menu" do + RSpec.describe "adding as a top level item" do before do namespace.register Category end it "should add a new menu item" do expect(menu['Categories']).to_not eq nil end - end # describe "adding as a top level item" + end # RSpec.describe "adding as a top level item" - describe "adding as a child" do + RSpec.describe "adding as a child" do before do namespace.register Category do menu parent: 'Blog' @@ -104,9 +104,9 @@ module ::Mock; class Resource; def self.has_many(arg1, arg2); end; end; end it "should generate its own child item" do expect(menu['Blog']['Categories']).to_not eq nil end - end # describe "adding as a child" + end # RSpec.describe "adding as a child" - describe "disabling the menu" do + RSpec.describe "disabling the menu" do before do namespace.register Category do menu false @@ -115,9 +115,9 @@ module ::Mock; class Resource; def self.has_many(arg1, arg2); end; end; end it "should not create a menu item" do expect(menu["Categories"]).to eq nil end - end # describe "disabling the menu" + end # RSpec.describe "disabling the menu" - describe "adding as a belongs to" do + RSpec.describe "adding as a belongs to" do context "when not optional" do before do namespace.register Post do @@ -139,9 +139,9 @@ module ::Mock; class Resource; def self.has_many(arg1, arg2); end; end; end end end end - end # describe "adding to the menu" + end # RSpec.describe "adding to the menu" - describe "dashboard controller name" do + RSpec.describe "dashboard controller name" do context "when namespaced" do it "should be namespaced" do namespace = ActiveAdmin::Namespace.new(application, :one) @@ -156,5 +156,5 @@ module ::Mock; class Resource; def self.has_many(arg1, arg2); end; end; end expect(defined?(Two::CategoriesController)).to eq 'constant' end end - end # describe "dashboard controller name" -end # describe "registering a resource" + end # RSpec.describe "dashboard controller name" +end # RSpec.describe "registering a resource" diff --git a/spec/unit/namespace_spec.rb b/spec/unit/namespace_spec.rb index 75928625186..5da5fe87075 100644 --- a/spec/unit/namespace_spec.rb +++ b/spec/unit/namespace_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Namespace do +RSpec.describe ActiveAdmin::Namespace do let(:application){ ActiveAdmin::Application.new } @@ -24,7 +24,7 @@ end end # context "when new" - describe "settings" do + RSpec.describe "settings" do let(:namespace){ ActiveAdmin::Namespace.new(application, :admin) } it "should inherit the site title from the application" do @@ -40,7 +40,7 @@ end - describe "#fetch_menu" do + RSpec.describe "#fetch_menu" do let(:namespace){ ActiveAdmin::Namespace.new(application, :admin) } it "returns the menu" do @@ -58,7 +58,7 @@ end end - describe "#build_menu" do + RSpec.describe "#build_menu" do let(:namespace){ ActiveAdmin::Namespace.new(application, :admin) } it "should set the block as a menu build callback" do @@ -78,7 +78,7 @@ end end - describe "utility navigation" do + RSpec.describe "utility navigation" do let(:namespace){ ActiveAdmin::Namespace.new(application, :admin) } let(:menu) do namespace.build_menu :utility_navigation do |menu| diff --git a/spec/unit/order_clause_spec.rb b/spec/unit/order_clause_spec.rb index db4da29befd..7a7d1c200bd 100644 --- a/spec/unit/order_clause_spec.rb +++ b/spec/unit/order_clause_spec.rb @@ -1,23 +1,23 @@ require 'rails_helper' -describe ActiveAdmin::OrderClause do - subject { described_class.new(config, clause) } +RSpec.describe ActiveAdmin::OrderClause do + subject { RSpec.described_class.new(config, clause) } let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new application, :admin } let(:config) { ActiveAdmin::Resource.new namespace, Post } - describe 'id_asc (existing column)' do + RSpec.describe 'id_asc (existing column)' do let(:clause) { 'id_asc' } it { is_expected.to be_valid } - describe '#field' do + RSpec.describe '#field' do subject { super().field } it { is_expected.to eq('id') } end - describe '#order' do + RSpec.describe '#order' do subject { super().order } it { is_expected.to eq('asc') } end @@ -27,17 +27,17 @@ end end - describe 'virtual_column_asc' do + RSpec.describe 'virtual_column_asc' do let(:clause) { 'virtual_column_asc' } it { is_expected.to be_valid } - describe '#field' do + RSpec.describe '#field' do subject { super().field } it { is_expected.to eq('virtual_column') } end - describe '#order' do + RSpec.describe '#order' do subject { super().order } it { is_expected.to eq('asc') } end @@ -47,17 +47,17 @@ end end - describe "hstore_col->'field'_desc" do + RSpec.describe "hstore_col->'field'_desc" do let(:clause) { "hstore_col->'field'_desc" } it { is_expected.to be_valid } - describe '#field' do + RSpec.describe '#field' do subject { super().field } it { is_expected.to eq("hstore_col->'field'") } end - describe '#order' do + RSpec.describe '#order' do subject { super().order } it { is_expected.to eq('desc') } end @@ -67,13 +67,13 @@ end end - describe '_asc' do + RSpec.describe '_asc' do let(:clause) { '_asc' } it { is_expected.not_to be_valid } end - describe 'nil' do + RSpec.describe 'nil' do let(:clause) { nil } it { is_expected.not_to be_valid } diff --git a/spec/unit/page_controller_spec.rb b/spec/unit/page_controller_spec.rb index 0d5ad5465c2..9a9cbe3d29d 100644 --- a/spec/unit/page_controller_spec.rb +++ b/spec/unit/page_controller_spec.rb @@ -1,5 +1,5 @@ require 'rails_helper' -describe ActiveAdmin::PageController do +RSpec.describe ActiveAdmin::PageController do let(:controller) { ActiveAdmin::PageController.new } end diff --git a/spec/unit/page_spec.rb b/spec/unit/page_spec.rb index 0ff3cbf5b64..06e9eead81f 100644 --- a/spec/unit/page_spec.rb +++ b/spec/unit/page_spec.rb @@ -4,7 +4,7 @@ require File.expand_path('config_shared_examples', File.dirname(__FILE__)) module ActiveAdmin - describe Page do + RSpec.describe Page do it_should_behave_like "ActiveAdmin::Resource" before { load_defaults! } @@ -17,7 +17,7 @@ def config(options = {}) @config ||= namespace.register_page("Chocolate I lØve You!", options) end - describe "controller name" do + RSpec.describe "controller name" do it "should return a namespaced controller name" do expect(config.controller_name).to eq "Admin::ChocolateILoveYouController" end @@ -29,7 +29,7 @@ def config(options = {}) end end - describe "#resource_name" do + RSpec.describe "#resource_name" do it "returns the name" do expect(config.resource_name).to eq "Chocolate I lØve You!" end @@ -43,25 +43,25 @@ def config(options = {}) end end - describe "#plural_resource_label" do + RSpec.describe "#plural_resource_label" do it "returns the singular name" do expect(config.plural_resource_label).to eq "Chocolate I lØve You!" end end - describe "#underscored_resource_name" do + RSpec.describe "#underscored_resource_name" do it "returns the resource name underscored" do expect(config.underscored_resource_name).to eq "chocolate_i_love_you" end end - describe "#camelized_resource_name" do + RSpec.describe "#camelized_resource_name" do it "returns the resource name camel case" do expect(config.camelized_resource_name).to eq "ChocolateILoveYou" end end - describe "#namespace_name" do + RSpec.describe "#namespace_name" do it "returns the name of the namespace" do expect(config.namespace_name).to eq "admin" end diff --git a/spec/unit/pretty_format_spec.rb b/spec/unit/pretty_format_spec.rb index c1b3634d0f9..0b06ee80dba 100644 --- a/spec/unit/pretty_format_spec.rb +++ b/spec/unit/pretty_format_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "#pretty_format" do +RSpec.describe "#pretty_format" do include ActiveAdmin::ViewHelpers::DisplayHelper def method_missing(*args, &block) diff --git a/spec/unit/pundit_adapter_spec.rb b/spec/unit/pundit_adapter_spec.rb index 1f02c66c9e1..9a974a2537d 100644 --- a/spec/unit/pundit_adapter_spec.rb +++ b/spec/unit/pundit_adapter_spec.rb @@ -28,9 +28,9 @@ def resolve end end -describe ActiveAdmin::PunditAdapter do +RSpec.describe ActiveAdmin::PunditAdapter do - describe "full integration" do + RSpec.describe "full integration" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new(application, "Admin") } @@ -49,7 +49,7 @@ def resolve end it "should scope the collection" do - class RSpec::Mocks::DoublePolicy < ApplicationPolicy + class RSpec.:Mocks::DoublePolicy < ApplicationPolicy class Scope < Struct.new(:user, :scope) def resolve scope diff --git a/spec/unit/resource/action_items_spec.rb b/spec/unit/resource/action_items_spec.rb index 53d7a149d91..9386cfce231 100644 --- a/spec/unit/resource/action_items_spec.rb +++ b/spec/unit/resource/action_items_spec.rb @@ -1,13 +1,13 @@ require 'rails_helper' -describe ActiveAdmin::Resource::ActionItems do +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 + RSpec.describe "adding a new action item" do before do resource.clear_action_items! @@ -30,7 +30,7 @@ end - describe "setting an action item to only display on specific controller actions" do + RSpec.describe "setting an action item to only display on specific controller actions" do before do resource.clear_action_items! @@ -51,7 +51,7 @@ end - describe "default action items" do + RSpec.describe "default action items" do it "should have 3 action items" do expect(resource.action_items.size).to eq 3 end diff --git a/spec/unit/resource/includes_spec.rb b/spec/unit/resource/includes_spec.rb index f38542591b4..d37d86e3567 100644 --- a/spec/unit/resource/includes_spec.rb +++ b/spec/unit/resource/includes_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' module ActiveAdmin - describe Resource, "Includes" do - describe "#includes" do + RSpec.describe Resource, "Includes" do + RSpec.describe "#includes" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new application, :admin } diff --git a/spec/unit/resource/menu_spec.rb b/spec/unit/resource/menu_spec.rb index 17f6ee7648b..2ab8a2e570d 100644 --- a/spec/unit/resource/menu_spec.rb +++ b/spec/unit/resource/menu_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' module ActiveAdmin - describe Resource, "Menu" do + RSpec.describe Resource, "Menu" do before { load_defaults! } diff --git a/spec/unit/resource/naming_spec.rb b/spec/unit/resource/naming_spec.rb index 81d06c88221..a1c7180d456 100644 --- a/spec/unit/resource/naming_spec.rb +++ b/spec/unit/resource/naming_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' module ActiveAdmin - describe Resource, "Naming" do + RSpec.describe Resource, "Naming" do before { load_defaults! } @@ -17,7 +17,7 @@ def config(options = {}) module ::Mock class Resource < ActiveRecord::Base; end; end module NoActiveModel class Resource; end; end - describe "singular resource name" do + RSpec.describe "singular resource name" do context "when class" do it "should be the underscored singular resource name" do expect(config.resource_name.singular).to eq "category" @@ -35,7 +35,7 @@ module NoActiveModel class Resource; end; end end end - describe "resource label" do + RSpec.describe "resource label" do it "should return a pretty name" do expect(config.resource_label).to eq "Category" end @@ -60,8 +60,8 @@ module NoActiveModel class Resource; end; end end end - describe "I18n integration" do - describe "singular label" do + RSpec.describe "I18n integration" do + RSpec.describe "singular label" do it "should return the titleized model_name.human" do expect(config.resource_name).to receive(:translate).and_return "Da category" @@ -69,14 +69,14 @@ module NoActiveModel class Resource; end; end end end - describe "plural label" do + RSpec.describe "plural label" do it "should return the titleized plural version defined by i18n if available" do expect(config.resource_name).to receive(:translate).at_least(:once).and_return "Da categories" expect(config.plural_resource_label).to eq "Da categories" end end - describe "plural label with not default locale" do + RSpec.describe "plural label with not default locale" do it "should return the titleized plural version defined by i18n with custom :count if available" do expect(config.resource_name).to receive(:translate).at_least(:once).and_return "Категории" expect(config.plural_resource_label(count: 3)).to eq "Категории" @@ -84,7 +84,7 @@ module NoActiveModel class Resource; end; end end context "when the :as option is given" do - describe "singular label" do + RSpec.describe "singular label" do it "should translate the custom name" do config = config(as: 'My Category') expect(config.resource_name).to receive(:translate).and_return "Translated category" @@ -92,7 +92,7 @@ module NoActiveModel class Resource; end; end end end - describe "plural label" do + RSpec.describe "plural label" do it "should translate the custom name" do config = config(as: 'My Category') expect(config.resource_name).to receive(:translate).at_least(:once).and_return "Translated categories" @@ -104,7 +104,7 @@ module NoActiveModel class Resource; end; end end end - describe "duplicate resource names" do + RSpec.describe "duplicate resource names" do let(:resource_name) { config.resource_name } let(:duplicate_resource_name) { Resource.new(namespace, Category).resource_name } diff --git a/spec/unit/resource/ordering_spec.rb b/spec/unit/resource/ordering_spec.rb index 1a230172b26..9e0066dd179 100644 --- a/spec/unit/resource/ordering_spec.rb +++ b/spec/unit/resource/ordering_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' module ActiveAdmin - describe Resource, "Ordering" do - describe "#order_by" do + RSpec.describe Resource, "Ordering" do + RSpec.describe "#order_by" do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new application, :admin } diff --git a/spec/unit/resource/page_presenters_spec.rb b/spec/unit/resource/page_presenters_spec.rb index 166bdced717..ca98899f9db 100644 --- a/spec/unit/resource/page_presenters_spec.rb +++ b/spec/unit/resource/page_presenters_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Resource::PagePresenters do +RSpec.describe ActiveAdmin::Resource::PagePresenters do let(:namespace){ ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin) } let(:resource){ namespace.register(Post) } @@ -21,7 +21,7 @@ expect(resource.page_presenters[:index].default).to eq page_presenter end - describe "#get_page_presenter" do + RSpec.describe "#get_page_presenter" do it "should return a page config when set" do page_presenter = ActiveAdmin::PagePresenter.new diff --git a/spec/unit/resource/pagination_spec.rb b/spec/unit/resource/pagination_spec.rb index 15be663844f..5d1cd5c88ed 100644 --- a/spec/unit/resource/pagination_spec.rb +++ b/spec/unit/resource/pagination_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' module ActiveAdmin - describe Resource, "Pagination" do + RSpec.describe Resource, "Pagination" do before { load_defaults! } @@ -12,7 +12,7 @@ def config(options = {}) @config ||= Resource.new(namespace, Category, options) end - describe "#paginate" do + RSpec.describe "#paginate" do it "should default to true" do expect(config.paginate).to eq true end @@ -23,7 +23,7 @@ def config(options = {}) end end - describe "#per_page" do + RSpec.describe "#per_page" do it "should default to namespace.default_per_page" do expect(namespace).to receive(:default_per_page).and_return(5) expect(config.per_page).to eq 5 diff --git a/spec/unit/resource/routes_spec.rb b/spec/unit/resource/routes_spec.rb index 7b95d708326..548e18cba1f 100644 --- a/spec/unit/resource/routes_spec.rb +++ b/spec/unit/resource/routes_spec.rb @@ -1,14 +1,14 @@ require 'rails_helper' module ActiveAdmin - describe Resource::Routes do + RSpec.describe Resource::Routes do after do load_defaults! reload_routes! end - describe "route names" do + RSpec.describe "route names" do context "when in the admin namespace" do let!(:config) { ActiveAdmin.register Category } let(:category) { Category.new { |c| c.id = 123 } } diff --git a/spec/unit/resource/scopes_spec.rb b/spec/unit/resource/scopes_spec.rb index 1a02f855bac..2fdfe232773 100644 --- a/spec/unit/resource/scopes_spec.rb +++ b/spec/unit/resource/scopes_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' module ActiveAdmin - describe Resource, "Scopes" do + RSpec.describe Resource, "Scopes" do before { load_defaults! } @@ -12,7 +12,7 @@ def config(options = {}) @config ||= Resource.new(namespace, Category, options) end - describe "adding a scope" do + RSpec.describe "adding a scope" do it "should add a scope" do config.scope :published diff --git a/spec/unit/resource/sidebars_spec.rb b/spec/unit/resource/sidebars_spec.rb index 94289631653..2d529788376 100644 --- a/spec/unit/resource/sidebars_spec.rb +++ b/spec/unit/resource/sidebars_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Resource::Sidebars do +RSpec.describe ActiveAdmin::Resource::Sidebars do let(:resource) do namespace = ActiveAdmin::Namespace.new(ActiveAdmin::Application.new, :admin) @@ -9,7 +9,7 @@ let(:sidebar) { ActiveAdmin::SidebarSection.new(:help) } - describe "adding a new sidebar section" do + RSpec.describe "adding a new sidebar section" do before do resource.clear_sidebar_sections! @@ -22,7 +22,7 @@ end - describe "retrieving sections for a controller action" do + RSpec.describe "retrieving sections for a controller action" do let(:only_index){ ActiveAdmin::SidebarSection.new(:help, only: :index) } let(:only_show){ ActiveAdmin::SidebarSection.new(:help, only: :show) } diff --git a/spec/unit/resource_collection_spec.rb b/spec/unit/resource_collection_spec.rb index 56881f06754..56e1ecab780 100644 --- a/spec/unit/resource_collection_spec.rb +++ b/spec/unit/resource_collection_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' require 'active_admin/resource_collection' -describe ActiveAdmin::ResourceCollection do +RSpec.describe ActiveAdmin::ResourceCollection do let(:application) { ActiveAdmin::Application.new } let(:namespace) { ActiveAdmin::Namespace.new application, :admin } let(:collection) { ActiveAdmin::ResourceCollection.new } @@ -30,7 +30,7 @@ expect(collection.keys).to eq [resource.resource_name] end - describe "#add" do + RSpec.describe "#add" do it "should return the resource" do expect(collection.add(resource)).to eq resource end @@ -64,7 +64,7 @@ }.to raise_error ActiveAdmin::ResourceCollection::IncorrectClass end - describe "should store both renamed and non-renamed resources" do + RSpec.describe "should store both renamed and non-renamed resources" do let(:resource) { ActiveAdmin::Resource.new namespace, Category } let(:renamed) { ActiveAdmin::Resource.new namespace, Category, as: "Subcategory" } @@ -82,7 +82,7 @@ end end - describe "#[]" do + RSpec.describe "#[]" do let(:resource) { ActiveAdmin::Resource.new namespace, resource_class } let(:inherited_resource) { ActiveAdmin::Resource.new namespace, inherited_resource_class } diff --git a/spec/unit/resource_controller/data_access_spec.rb b/spec/unit/resource_controller/data_access_spec.rb index 5fbc781b330..d3f31a9f1c9 100644 --- a/spec/unit/resource_controller/data_access_spec.rb +++ b/spec/unit/resource_controller/data_access_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::ResourceController::DataAccess do +RSpec.describe ActiveAdmin::ResourceController::DataAccess do let(:params) do {} end @@ -13,7 +13,7 @@ rc end - describe "searching" do + RSpec.describe "searching" do let(:params) {{ q: {} }} it "should call the search method" do chain = double "ChainObj" @@ -38,7 +38,7 @@ end - describe "sorting" do + RSpec.describe "sorting" do context "valid clause" do let(:params) {{ order: "id_asc" }} @@ -91,7 +91,7 @@ end - describe "scoping" do + RSpec.describe "scoping" do context "when no current scope" do it "should set collection_before_scope to the chain and return the chain" do @@ -115,7 +115,7 @@ end end - describe "includes" do + RSpec.describe "includes" do context "with no includes" do it "should return the chain" do chain = double "ChainObj" @@ -134,7 +134,7 @@ end end - describe "find_collection" do + RSpec.describe "find_collection" do let(:appliers) do ActiveAdmin::ResourceController::DataAccess::COLLECTION_APPLIES end @@ -158,7 +158,7 @@ controller.send :find_collection end - describe "collection_applies" do + RSpec.describe "collection_applies" do context "excepting appliers" do let(:options) do { except: diff --git a/spec/unit/resource_controller/decorators_spec.rb b/spec/unit/resource_controller/decorators_spec.rb index 1fa822394bd..7cf861c2321 100644 --- a/spec/unit/resource_controller/decorators_spec.rb +++ b/spec/unit/resource_controller/decorators_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::ResourceController::Decorators do +RSpec.describe ActiveAdmin::ResourceController::Decorators do let(:controller_class) do Class.new do def self.name @@ -20,7 +20,7 @@ def self.name allow(controller).to receive(:action_name).and_return(action) end - describe '#apply_decorator' do + RSpec.describe '#apply_decorator' do let(:action) { 'show' } let(:resource) { Post.new } subject(:applied) { controller.apply_decorator(resource) } @@ -47,7 +47,7 @@ def self.name end end - describe '#apply_collection_decorator' do + RSpec.describe '#apply_collection_decorator' do before { Post.create! } let(:action) { 'index' } let(:collection) { Post.where nil } @@ -71,7 +71,7 @@ def self.name end end - describe 'form actions' do + RSpec.describe 'form actions' do let(:action) { 'edit' } let(:resource) { Post.new } let(:form_presenter) { double options: { decorate: decorate_form } } diff --git a/spec/unit/resource_controller/sidebars_spec.rb b/spec/unit/resource_controller/sidebars_spec.rb index 28bed17cb02..b6c67b53a3a 100644 --- a/spec/unit/resource_controller/sidebars_spec.rb +++ b/spec/unit/resource_controller/sidebars_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' -describe ActiveAdmin::ResourceController::Sidebars, type: :controller do +RSpec.describe ActiveAdmin::ResourceController::Sidebars, type: :controller do let(:klass){ Admin::PostsController } - render_views # https://github.com/rspec/rspec-rails/issues/860 + render_views # https://github.com/RSpec.RSpec.rails/issues/860 before do @controller = klass.new @@ -21,7 +21,7 @@ end end - describe '#skip_sidebar!' do + RSpec.describe '#skip_sidebar!' do before do ActiveAdmin.register Post do before_filter :skip_sidebar! diff --git a/spec/unit/resource_controller_spec.rb b/spec/unit/resource_controller_spec.rb index 71cabeab813..a3c5f22351b 100644 --- a/spec/unit/resource_controller_spec.rb +++ b/spec/unit/resource_controller_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' -describe ActiveAdmin::ResourceController do +RSpec.describe ActiveAdmin::ResourceController do let(:controller) { ActiveAdmin::ResourceController.new } - describe "authenticating the user" do + RSpec.describe "authenticating the user" do let(:controller){ Admin::PostsController.new } it "should do nothing when no authentication_method set" do @@ -27,7 +27,7 @@ end - describe "retrieving the current user" do + RSpec.describe "retrieving the current user" do let(:controller){ Admin::PostsController.new } it "should return nil when no current_user_method set" do @@ -51,7 +51,7 @@ end - describe "callbacks" do + RSpec.describe "callbacks" do before :all do application = ::ActiveAdmin::Application.new namespace = ActiveAdmin::Namespace.new(application, :admin) @@ -80,7 +80,7 @@ def call_after_destroy(obj); end end end - describe "performing create" do + RSpec.describe "performing create" do let(:controller){ Admin::PostsController.new } let(:resource){ double("Resource", save: true) } @@ -106,7 +106,7 @@ def call_after_destroy(obj); end end end - describe "performing update" do + RSpec.describe "performing update" do let(:controller){ Admin::PostsController.new } let(:resource){ double("Resource", :attributes= => true, save: true) } let(:attributes){ [{}] } @@ -134,7 +134,7 @@ def call_after_destroy(obj); end end end - describe "performing destroy" do + RSpec.describe "performing destroy" do let(:controller){ Admin::PostsController.new } let(:resource){ double("Resource", destroy: true) } @@ -155,9 +155,9 @@ def call_after_destroy(obj); end end end -describe Admin::PostsController, type: "controller" do +RSpec.describe Admin::PostsController, type: "controller" do - describe 'retrieving the resource' do + RSpec.describe 'retrieving the resource' do let(:controller){ Admin::PostsController.new } let(:post) { Post.new title: "An incledibly unique Post Title" } @@ -186,7 +186,7 @@ def call_after_destroy(obj); end end end - describe 'retrieving the resource collection' do + RSpec.describe 'retrieving the resource collection' do let(:controller){ Admin::PostsController.new } let(:config) { controller.class.active_admin_config } before do @@ -222,7 +222,7 @@ def call_after_destroy(obj); end end - describe "performing batch_action" do + RSpec.describe "performing batch_action" do let(:controller){ Admin::PostsController.new } let(:batch_action) { ActiveAdmin::BatchAction.new :flag, "Flag", &batch_action_block } let(:batch_action_block) { proc { } } @@ -230,7 +230,7 @@ def call_after_destroy(obj); end allow(controller.class.active_admin_config).to receive(:batch_actions).and_return([batch_action]) end - describe "when params batch_action matches existing BatchAction" do + RSpec.describe "when params batch_action matches existing BatchAction" do before do allow(controller).to receive(:params) { { batch_action: "flag", collection_selection: ["1"] } } end @@ -246,7 +246,7 @@ def call_after_destroy(obj); end end end - describe "when params batch_action doesn't match a BatchAction" do + RSpec.describe "when params batch_action doesn't match a BatchAction" do it "should raise an error" do allow(controller).to receive(:params) { { batch_action: "derp", collection_selection: ["1"] } } expect { @@ -255,7 +255,7 @@ def call_after_destroy(obj); end end end - describe "when params batch_action is blank" do + RSpec.describe "when params batch_action is blank" do it "should raise an error" do allow(controller).to receive(:params) { { collection_selection: ["1"] } } expect { diff --git a/spec/unit/resource_registration_spec.rb b/spec/unit/resource_registration_spec.rb index 43022fedf12..7d5facc4d66 100644 --- a/spec/unit/resource_registration_spec.rb +++ b/spec/unit/resource_registration_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe "Registering an object to administer" do +RSpec.describe "Registering an object to administer" do application = ActiveAdmin::Application.new context "with no configuration" do diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb index 27e3a75551b..c281087f8f7 100644 --- a/spec/unit/resource_spec.rb +++ b/spec/unit/resource_spec.rb @@ -2,7 +2,7 @@ require File.expand_path('config_shared_examples', File.dirname(__FILE__)) module ActiveAdmin - describe Resource do + RSpec.describe Resource do it_should_behave_like "ActiveAdmin::Resource" before { load_defaults! } @@ -16,7 +16,7 @@ def config(options = {}) it { respond_to :resource_class } - describe "#resource_table_name" do + RSpec.describe "#resource_table_name" do it "should return the resource's table name" do expect(config.resource_table_name).to eq '"categories"' end @@ -27,13 +27,13 @@ def config(options = {}) end end - describe "#resource_column_names" do + RSpec.describe "#resource_column_names" do it "should return the resource's column names" do expect(config.resource_column_names).to eq Category.column_names end end - describe '#decorator_class' do + RSpec.describe '#decorator_class' do it 'returns nil by default' do expect(config.decorator_class).to eq nil end @@ -50,7 +50,7 @@ def config(options = {}) end - describe "controller name" do + RSpec.describe "controller name" do it "should return a namespaced controller name" do expect(config.controller_name).to eq "Admin::CategoriesController" end @@ -62,7 +62,7 @@ def config(options = {}) end end - describe "#include_in_menu?" do + RSpec.describe "#include_in_menu?" do let(:namespace){ ActiveAdmin::Namespace.new(application, :admin) } subject{ resource } @@ -77,7 +77,7 @@ def config(options = {}) end end - describe "#belongs_to" do + RSpec.describe "#belongs_to" do it "should build a belongs to configuration" do expect(config.belongs_to_config.length).to eq 0 @@ -93,7 +93,7 @@ def config(options = {}) end - describe "scoping" do + RSpec.describe "scoping" do context "when using a block" do before do @resource = application.register Category do @@ -122,7 +122,7 @@ def config(options = {}) end end - describe "getting the method for the association chain" do + RSpec.describe "getting the method for the association chain" do context "when a simple registration" do before do @resource = application.register Category do @@ -147,7 +147,7 @@ def config(options = {}) end - describe "sort order" do + RSpec.describe "sort order" do context "when resource class responds to primary_key" do it "should sort by primary key desc by default" do @@ -171,7 +171,7 @@ def config(options = {}) end - describe "adding a scope" do + RSpec.describe "adding a scope" do it "should add a scope" do config.scope :published @@ -192,7 +192,7 @@ def config(options = {}) end - describe "#csv_builder" do + RSpec.describe "#csv_builder" do context "when no csv builder set" do it "should return a default column builder with id and content columns" do expect(config.csv_builder.exec_columns.size).to eq Category.content_columns.size + 1 @@ -208,7 +208,7 @@ def config(options = {}) end end - describe "#breadcrumb" do + RSpec.describe "#breadcrumb" do subject { config.breadcrumb } context "when no breadcrumb is set" do @@ -228,7 +228,7 @@ def config(options = {}) end end - describe '#find_resource' do + RSpec.describe '#find_resource' do let(:resource) { namespace.register(Post) } let(:post) { double } before do @@ -291,7 +291,7 @@ def config(options = {}) end end - describe "delegation" do + RSpec.describe "delegation" do let(:controller) { Class.new do def method_missing(name, *args, &block) diff --git a/spec/unit/routing_spec.rb b/spec/unit/routing_spec.rb index 9af60e1c083..e785719bc9b 100644 --- a/spec/unit/routing_spec.rb +++ b/spec/unit/routing_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -describe ActiveAdmin, "Routing", type: :routing do +RSpec.describe ActiveAdmin, "Routing", type: :routing do before do load_defaults! @@ -22,7 +22,7 @@ expect(get('/admin')).to route_to 'admin/dashboard#index' end - describe "root path helper" do + RSpec.describe "root path helper" do context "when in admin namespace" do it "should be admin_root_path" do expect(admin_root_path).to eq "/admin" @@ -30,7 +30,7 @@ end end - describe "route_options" do + RSpec.describe "route_options" do context "with a custom path set in route_options" do before(:each) do ActiveAdmin.application.namespaces[:admin].route_options = { path: '/custom-path' } @@ -48,7 +48,7 @@ end end - describe "standard resources" do + RSpec.describe "standard resources" do context "when in admin namespace" do it "should route the index path" do expect(admin_posts_path).to eq "/admin/posts" @@ -133,7 +133,7 @@ end end - describe "belongs to resource" do + RSpec.describe "belongs to resource" do it "should route the nested index path" do expect(admin_user_posts_path(1)).to eq "/admin/users/1/posts" end @@ -169,7 +169,7 @@ end end - describe "nested belongs to resource" do + RSpec.describe "nested belongs to resource" do before do ActiveAdmin.register(Tagging) do belongs_to :user, optional: true @@ -194,7 +194,7 @@ end end - describe "page" do + RSpec.describe "page" do context "when default namespace" do before(:each) do load_resources { ActiveAdmin.register_page("Chocolate I lØve You!") } diff --git a/spec/unit/scope_spec.rb b/spec/unit/scope_spec.rb index 77744f30986..94fa2496b9c 100644 --- a/spec/unit/scope_spec.rb +++ b/spec/unit/scope_spec.rb @@ -1,24 +1,24 @@ require 'rails_helper' -describe ActiveAdmin::Scope do +RSpec.describe ActiveAdmin::Scope do - describe "creating a scope" do + RSpec.describe "creating a scope" do subject{ scope } context "when just a scope method" do let(:scope) { ActiveAdmin::Scope.new :published } - describe '#name' do + RSpec.describe '#name' do subject { super().name } it { is_expected.to eq("Published")} end - describe '#id' do + RSpec.describe '#id' do subject { super().id } it { is_expected.to eq("published")} end - describe '#scope_method' do + RSpec.describe '#scope_method' do subject { super().scope_method } it { is_expected.to eq(:published) } end @@ -27,24 +27,24 @@ context "when scope method is :all" do let(:scope) { ActiveAdmin::Scope.new :all } - describe '#name' do + RSpec.describe '#name' do subject { super().name } it { is_expected.to eq("All")} end - describe '#id' do + RSpec.describe '#id' do subject { super().id } it { is_expected.to eq("all")} end # :all does not return a chain but an array of active record # instances. We set the scope_method to nil then. - describe '#scope_method' do + RSpec.describe '#scope_method' do subject { super().scope_method } it { is_expected.to eq(nil) } end - describe '#scope_block' do + RSpec.describe '#scope_block' do subject { super().scope_block } it { is_expected.to eq(nil) } end @@ -53,17 +53,17 @@ context 'when a name and scope method is :all' do let(:scope) { ActiveAdmin::Scope.new 'Tous', :all } - describe '#name' do + RSpec.describe '#name' do subject { super().name } it { is_expected.to eq 'Tous' } end - describe '#scope_method' do + RSpec.describe '#scope_method' do subject { super().scope_method } it { is_expected.to eq nil } end - describe '#scope_block' do + RSpec.describe '#scope_block' do subject { super().scope_block } it { is_expected.to eq nil } end @@ -72,17 +72,17 @@ context "when a name and scope method" do let(:scope) { ActiveAdmin::Scope.new "With API Access", :with_api_access } - describe '#name' do + RSpec.describe '#name' do subject { super().name } it { is_expected.to eq("With API Access")} end - describe '#id' do + RSpec.describe '#id' do subject { super().id } it { is_expected.to eq("with_api_access")} end - describe '#scope_method' do + RSpec.describe '#scope_method' do subject { super().scope_method } it { is_expected.to eq(:with_api_access) } end @@ -91,22 +91,22 @@ context "when a name and scope block" do let(:scope) { ActiveAdmin::Scope.new("My Scope"){|s| s } } - describe '#name' do + RSpec.describe '#name' do subject { super().name } it { is_expected.to eq("My Scope")} end - describe '#id' do + RSpec.describe '#id' do subject { super().id } it { is_expected.to eq("my_scope")} end - describe '#scope_method' do + RSpec.describe '#scope_method' do subject { super().scope_method } it { is_expected.to eq(nil) } end - describe '#scope_block' do + RSpec.describe '#scope_block' do subject { super().scope_block } it { is_expected.to be_a(Proc)} end @@ -115,12 +115,12 @@ context "when a name has a space and lowercase" do let(:scope) { ActiveAdmin::Scope.new("my scope") } - describe '#name' do + RSpec.describe '#name' do subject { super().name } it { is_expected.to eq("my scope")} end - describe '#id' do + RSpec.describe '#id' do subject { super().id } it { is_expected.to eq("my_scope")} end @@ -147,25 +147,25 @@ end let(:scope) { ActiveAdmin::Scope.new :published, :published, localizer: localizer } - describe '#name' do + RSpec.describe '#name' do subject { super().name } it { is_expected.to eq("All published")} end - describe '#id' do + RSpec.describe '#id' do subject { super().id } it { is_expected.to eq("published")} end - describe '#scope_method' do + RSpec.describe '#scope_method' do subject { super().scope_method } it { is_expected.to eq(:published) } end end - end # describe "creating a scope" + end # RSpec.describe "creating a scope" - describe "#display_if_block" do + RSpec.describe "#display_if_block" do it "should return true by default" do scope = ActiveAdmin::Scope.new(:default) expect(scope.display_if_block.call).to eq true @@ -177,7 +177,7 @@ end end - describe "#default" do + RSpec.describe "#default" do it "should accept a boolean" do scope = ActiveAdmin::Scope.new(:method, nil, default: true) expect(scope.default_block).to eq true @@ -194,7 +194,7 @@ end end - describe "show_count" do + RSpec.describe "show_count" do it "should allow setting of show_count to prevent showing counts" do scope = ActiveAdmin::Scope.new(:default, nil, show_count: false) expect(scope.show_count).to eq false diff --git a/spec/unit/settings_spec.rb b/spec/unit/settings_spec.rb index 709843f3a64..11292c45cdb 100644 --- a/spec/unit/settings_spec.rb +++ b/spec/unit/settings_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Settings do +RSpec.describe ActiveAdmin::Settings do subject{ Class.new{ include ActiveAdmin::Settings } } @@ -8,7 +8,7 @@ it{ is_expected.to respond_to :deprecated_setting } it{ is_expected.to respond_to :default_settings } - describe "class API" do + RSpec.describe "class API" do it "should create settings" do subject.setting :foo, 'bar' expect(subject.default_settings[:foo]).to eq 'bar' @@ -21,7 +21,7 @@ end end - describe "instance API" do + RSpec.describe "instance API" do before do subject.setting :foo, 'bar' @@ -46,7 +46,7 @@ end -describe ActiveAdmin::Settings::Inheritance do +RSpec.describe ActiveAdmin::Settings::Inheritance do subject do Class.new do @@ -65,7 +65,7 @@ subject.settings_inherited_by heir end - describe "class API" do + RSpec.describe "class API" do it "should add setting to an heir" do subject.inheritable_setting :one, 2 expect(heir.default_settings[:one]).to eq 2 @@ -78,8 +78,8 @@ end end - describe "instance API" do - describe "the setter `config.left =`" do + RSpec.describe "instance API" do + RSpec.describe "the setter `config.left =`" do before{ subject.inheritable_setting :left, :right } it "should work" do config = heir.new @@ -88,14 +88,14 @@ end end - describe "the getter `config.left`" do + RSpec.describe "the getter `config.left`" do before{ subject.inheritable_setting :left, :right } it "should work" do expect(heir.new.left).to eq :right end end - describe "the getter with question-mark `config.left?`" do + RSpec.describe "the getter with question-mark `config.left?`" do { "nil" => [nil, false], "false" => [false, false], diff --git a/spec/unit/view_factory_spec.rb b/spec/unit/view_factory_spec.rb index 06f605f3236..10378ca2310 100644 --- a/spec/unit/view_factory_spec.rb +++ b/spec/unit/view_factory_spec.rb @@ -6,7 +6,7 @@ def it_should_have_view(key, value) end end -describe ActiveAdmin::ViewFactory do +RSpec.describe ActiveAdmin::ViewFactory do it_should_have_view :global_navigation, ActiveAdmin::Views::TabbedNavigation it_should_have_view :utility_navigation, ActiveAdmin::Views::TabbedNavigation diff --git a/spec/unit/view_helpers/breadcrumbs_spec.rb b/spec/unit/view_helpers/breadcrumbs_spec.rb index 59660b9819a..291d0ac7d70 100644 --- a/spec/unit/view_helpers/breadcrumbs_spec.rb +++ b/spec/unit/view_helpers/breadcrumbs_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' -describe "Breadcrumbs" do +RSpec.describe "Breadcrumbs" do include ActiveAdmin::ViewHelpers - describe "generating a trail from paths" do + RSpec.describe "generating a trail from paths" do def params; {}; end def link_to(name, url); {name: name, path: url}; end diff --git a/spec/unit/view_helpers/display_helper_spec.rb b/spec/unit/view_helpers/display_helper_spec.rb index d569233814e..d4caf16fe48 100644 --- a/spec/unit/view_helpers/display_helper_spec.rb +++ b/spec/unit/view_helpers/display_helper_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::ViewHelpers::DisplayHelper do +RSpec.describe ActiveAdmin::ViewHelpers::DisplayHelper do include ActiveAdmin::ViewHelpers::ActiveAdminApplicationHelper include ActiveAdmin::ViewHelpers::AutoLinkHelper include ActiveAdmin::ViewHelpers::DisplayHelper @@ -20,7 +20,7 @@ def url_options { locale: nil } end - describe '#display_name' do + RSpec.describe '#display_name' do ActiveAdmin::Application.new.display_name_methods.map(&:to_s).each do |m| it "should return #{m} when defined" do klass = Class.new do @@ -89,7 +89,7 @@ class ThisModel end end - describe '#format_attribute' do + RSpec.describe '#format_attribute' do it 'calls the provided block to format the value' do value = format_attribute double(foo: 2), ->r { r.foo + 1 } diff --git a/spec/unit/view_helpers/download_format_links_helper_spec.rb b/spec/unit/view_helpers/download_format_links_helper_spec.rb index 0a761bc5c66..a565a456a50 100644 --- a/spec/unit/view_helpers/download_format_links_helper_spec.rb +++ b/spec/unit/view_helpers/download_format_links_helper_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -describe ActiveAdmin::ViewHelpers::DownloadFormatLinksHelper do - describe "class methods" do +RSpec.describe ActiveAdmin::ViewHelpers::DownloadFormatLinksHelper do + RSpec.describe "class methods" do before :all do begin # The mime type to be used in respond_to |format| style web-services in rails diff --git a/spec/unit/view_helpers/fields_for_spec.rb b/spec/unit/view_helpers/fields_for_spec.rb index 3f1acd6310a..f531ef8ea7c 100644 --- a/spec/unit/view_helpers/fields_for_spec.rb +++ b/spec/unit/view_helpers/fields_for_spec.rb @@ -1,6 +1,6 @@ require 'active_admin/view_helpers/fields_for' -describe ActiveAdmin::ViewHelpers::FormHelper, ".fields_for" do +RSpec.describe ActiveAdmin::ViewHelpers::FormHelper, ".fields_for" do include ActiveAdmin::ViewHelpers::FormHelper it "should skip :action, :controller and :commit" do diff --git a/spec/unit/view_helpers/flash_helper_spec.rb b/spec/unit/view_helpers/flash_helper_spec.rb index 7d72802396e..393ac4168bd 100644 --- a/spec/unit/view_helpers/flash_helper_spec.rb +++ b/spec/unit/view_helpers/flash_helper_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' -describe ActiveAdmin::ViewHelpers::FlashHelper do +RSpec.describe ActiveAdmin::ViewHelpers::FlashHelper do - describe '.flash_messages' do + RSpec.describe '.flash_messages' do let(:view) { action_view } it "should not include 'timedout' flash messages by default" do diff --git a/spec/unit/view_helpers/form_helper_spec.rb b/spec/unit/view_helpers/form_helper_spec.rb index e97964ee9a4..40203c94d26 100644 --- a/spec/unit/view_helpers/form_helper_spec.rb +++ b/spec/unit/view_helpers/form_helper_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' -describe ActiveAdmin::ViewHelpers::FormHelper do +RSpec.describe ActiveAdmin::ViewHelpers::FormHelper do - describe '.active_admin_form_for' do + RSpec.describe '.active_admin_form_for' do let(:view) { action_view } let(:resource) { double 'resource' } let(:default_options) { { builder: ActiveAdmin::FormBuilder } } @@ -21,7 +21,7 @@ end end - describe ".hidden_field_tags_for" do + RSpec.describe ".hidden_field_tags_for" do let(:view) { action_view } it "should render hidden field tags for params" do diff --git a/spec/unit/view_helpers/method_or_proc_helper_spec.rb b/spec/unit/view_helpers/method_or_proc_helper_spec.rb index 41a1e7de2a6..68e04849e65 100644 --- a/spec/unit/view_helpers/method_or_proc_helper_spec.rb +++ b/spec/unit/view_helpers/method_or_proc_helper_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe MethodOrProcHelper do +RSpec.describe MethodOrProcHelper do let(:receiver) { double } let(:context) do @@ -9,7 +9,7 @@ obj end - describe "#call_method_or_exec_proc" do + RSpec.describe "#call_method_or_exec_proc" do it "should call the method in the context when a symbol" do expect(context.call_method_or_exec_proc(:receiver_in_context)).to eq receiver @@ -29,7 +29,7 @@ end - describe "#call_method_or_proc_on" do + RSpec.describe "#call_method_or_proc_on" do [:hello, 'hello'].each do |key| context "when a #{key.class}" do @@ -90,7 +90,7 @@ end - describe "#render_or_call_method_or_proc_on" do + RSpec.describe "#render_or_call_method_or_proc_on" do [ :symbol, Proc.new{} ].each do |key| context "when a #{key.class}" do it "should call #call_method_or_proc_on" do @@ -108,7 +108,7 @@ end end - describe "#render_in_context" do + RSpec.describe "#render_in_context" do let(:args) { [1, 2, 3] } context "when a Proc" do diff --git a/spec/unit/views/components/attributes_table_spec.rb b/spec/unit/views/components/attributes_table_spec.rb index 0d393b994c0..a2df895b103 100644 --- a/spec/unit/views/components/attributes_table_spec.rb +++ b/spec/unit/views/components/attributes_table_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' -describe ActiveAdmin::Views::AttributesTable do +RSpec.describe ActiveAdmin::Views::AttributesTable do - describe "creating with the dsl" do + RSpec.describe "creating with the dsl" do let(:helpers) { action_view } let(:post) do @@ -74,13 +74,13 @@ expect(table.find_by_tag("tr").size).to eq 3 end - describe "rendering the rows" do + RSpec.describe "rendering the rows" do [ ["Id" , "1"], ["Title" , "Hello World"], ["Body" , "Empty"] ].each_with_index do |(title, content), i| - describe "for #{title}" do + RSpec.describe "for #{title}" do let(:current_row){ table.find_by_tag("tr")[i] } it "should have the title '#{title}'" do @@ -92,10 +92,10 @@ end end end - end # describe rendering rows + end # RSpec.describe rendering rows end - end # describe dsl styles + end # RSpec.describe dsl styles it "should add a class for each row based on the col name" do table = render_arbre_component(assigns) { @@ -208,7 +208,7 @@ ["Id" , "1", "2"], ["Title", "Hello World", "Multi Column"], ].each_with_index do |set, i| - describe "for #{set[0]}" do + RSpec.describe "for #{set[0]}" do let(:title){ set[0] } let(:content){ set[1] } let(:current_row){ table.find_by_tag("tr")[i] } @@ -232,7 +232,7 @@ end end end - end # describe rendering rows + end # RSpec.describe rendering rows end # with a collection diff --git a/spec/unit/views/components/batch_action_selector_spec.rb b/spec/unit/views/components/batch_action_selector_spec.rb index 9694ff72ee3..f151a599bfe 100644 --- a/spec/unit/views/components/batch_action_selector_spec.rb +++ b/spec/unit/views/components/batch_action_selector_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' require 'active_admin/batch_actions/views/batch_action_selector' -describe ActiveAdmin::BatchActions::BatchActionSelector do +RSpec.describe ActiveAdmin::BatchActions::BatchActionSelector do let(:dropdown) do render_arbre_component do @@ -13,27 +13,27 @@ end end - describe "the action list" do + RSpec.describe "the action list" do subject do dropdown.find_by_class("dropdown_menu_list").first end - describe '#tag_name' do + RSpec.describe '#tag_name' do subject { super().tag_name } it { is_expected.to eql("ul") } end - describe '#content' do + RSpec.describe '#content' do subject { super().content } it{ is_expected.to include("class=\"batch_action\" data-action=\"action_1\"") } end - describe '#content' do + RSpec.describe '#content' do subject { super().content } it{ is_expected.to include("class=\"batch_action\" data-action=\"action_2\"") } end - describe '#content' do + RSpec.describe '#content' do subject { super().content } it{ is_expected.to include("class=\"batch_action\" data-action=\"action_3\"") } end diff --git a/spec/unit/views/components/blank_slate_spec.rb b/spec/unit/views/components/blank_slate_spec.rb index 6bacd0b95ac..4d6916d7e25 100644 --- a/spec/unit/views/components/blank_slate_spec.rb +++ b/spec/unit/views/components/blank_slate_spec.rb @@ -1,25 +1,25 @@ require 'rails_helper' -describe ActiveAdmin::Views::BlankSlate do +RSpec.describe ActiveAdmin::Views::BlankSlate do - describe "#blank_slate" do + RSpec.describe "#blank_slate" do subject do render_arbre_component do blank_slate("There are no Posts yet. Create one") end end - describe '#tag_name' do + RSpec.describe '#tag_name' do subject { super().tag_name } it { is_expected.to eql 'div' } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('blank_slate_container') } end - describe '#content' do + RSpec.describe '#content' do subject { super().content } it { is_expected.to include 'There are no Posts yet. Create one' } end diff --git a/spec/unit/views/components/columns_spec.rb b/spec/unit/views/components/columns_spec.rb index 41e8f016622..5494fc63656 100644 --- a/spec/unit/views/components/columns_spec.rb +++ b/spec/unit/views/components/columns_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' -describe ActiveAdmin::Views::Columns do +RSpec.describe ActiveAdmin::Views::Columns do - describe "Rendering zero columns" do + RSpec.describe "Rendering zero columns" do let(:cols) do render_arbre_component do columns do @@ -19,7 +19,7 @@ end end - describe "Rendering one column" do + RSpec.describe "Rendering one column" do let(:cols) do render_arbre_component do columns do @@ -42,7 +42,7 @@ end end - describe "Rendering two columns" do + RSpec.describe "Rendering two columns" do let(:cols) do render_arbre_component do columns do @@ -65,7 +65,7 @@ end end - describe "Rendering four columns" do + RSpec.describe "Rendering four columns" do let(:cols) do render_arbre_component do columns do @@ -94,7 +94,7 @@ end - describe "Column Spans" do + RSpec.describe "Column Spans" do let(:cols) do render_arbre_component do columns do @@ -114,7 +114,7 @@ end end - describe "Column max width" do + RSpec.describe "Column max width" do let(:cols) do render_arbre_component do @@ -150,7 +150,7 @@ end - describe "Column min width" do + RSpec.describe "Column min width" do let(:cols) do render_arbre_component do diff --git a/spec/unit/views/components/index_list_spec.rb b/spec/unit/views/components/index_list_spec.rb index d7e60cde142..7ad04f98f0f 100644 --- a/spec/unit/views/components/index_list_spec.rb +++ b/spec/unit/views/components/index_list_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' -describe ActiveAdmin::Views::IndexList do +RSpec.describe ActiveAdmin::Views::IndexList do - describe "#index_list_renderer" do + RSpec.describe "#index_list_renderer" do let(:index_classes) { [ActiveAdmin::Views::IndexAsTable, ActiveAdmin::Views::IndexAsBlock] } @@ -26,7 +26,7 @@ end end - describe '#tag_name' do + RSpec.describe '#tag_name' do subject { super().tag_name } it { is_expected.to eq 'ul'} end diff --git a/spec/unit/views/components/index_table_for_spec.rb b/spec/unit/views/components/index_table_for_spec.rb index 990772791bd..64fa850f209 100644 --- a/spec/unit/views/components/index_table_for_spec.rb +++ b/spec/unit/views/components/index_table_for_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -describe ActiveAdmin::Views::IndexAsTable::IndexTableFor do - describe 'creating with the dsl' do +RSpec.describe ActiveAdmin::Views::IndexAsTable::IndexTableFor do + RSpec.describe 'creating with the dsl' do let(:collection) do [Post.new(title: 'First Post', starred: true)] end diff --git a/spec/unit/views/components/paginated_collection_spec.rb b/spec/unit/views/components/paginated_collection_spec.rb index 7c54f82e0cb..35cf7512fbb 100644 --- a/spec/unit/views/components/paginated_collection_spec.rb +++ b/spec/unit/views/components/paginated_collection_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -describe ActiveAdmin::Views::PaginatedCollection do - describe "creating with the dsl" do +RSpec.describe ActiveAdmin::Views::PaginatedCollection do + RSpec.describe "creating with the dsl" do before :all do load_defaults! @@ -210,7 +210,7 @@ def paginated_collection(*args) Kaminari.paginate_array([Post.new] * 256).page(1).per(30) end - describe "set to false" do + RSpec.describe "set to false" do it "should not show the total item counts" do expect(collection).not_to receive(:total_pages) pagination = paginated_collection(collection, pagination_total: false) @@ -219,7 +219,7 @@ def paginated_collection(*args) end end - describe "set to true" do + RSpec.describe "set to true" do let(:pagination) { paginated_collection(collection, pagination_total: true) } it "should show the total item counts" do diff --git a/spec/unit/views/components/panel_spec.rb b/spec/unit/views/components/panel_spec.rb index a33fc5cb749..eed2b745f08 100644 --- a/spec/unit/views/components/panel_spec.rb +++ b/spec/unit/views/components/panel_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Views::Panel do +RSpec.describe ActiveAdmin::Views::Panel do let(:arbre_panel) do render_arbre_component do panel "My Title" do @@ -44,7 +44,7 @@ end end - describe "#children?" do + RSpec.describe "#children?" do let(:arbre_panel) do render_arbre_component do panel("A Panel") diff --git a/spec/unit/views/components/sidebar_section_spec.rb b/spec/unit/views/components/sidebar_section_spec.rb index 1f7a84ef2b9..5c31adb4865 100644 --- a/spec/unit/views/components/sidebar_section_spec.rb +++ b/spec/unit/views/components/sidebar_section_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Views::SidebarSection do +RSpec.describe ActiveAdmin::Views::SidebarSection do let(:options) { {} } diff --git a/spec/unit/views/components/site_title_spec.rb b/spec/unit/views/components/site_title_spec.rb index fef2d0fd3cd..709617866ba 100644 --- a/spec/unit/views/components/site_title_spec.rb +++ b/spec/unit/views/components/site_title_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Views::SiteTitle do +RSpec.describe ActiveAdmin::Views::SiteTitle do let(:helpers){ mock_action_view } diff --git a/spec/unit/views/components/status_tag_spec.rb b/spec/unit/views/components/status_tag_spec.rb index 7dba5da93cf..9df0a581b55 100644 --- a/spec/unit/views/components/status_tag_spec.rb +++ b/spec/unit/views/components/status_tag_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' -describe ActiveAdmin::Views::StatusTag do +RSpec.describe ActiveAdmin::Views::StatusTag do - describe "#status_tag" do + RSpec.describe "#status_tag" do # Helper method to build StatusTag objects in an Arbre context def status_tag(*args) @@ -13,12 +13,12 @@ def status_tag(*args) subject { status_tag(nil) } - describe '#tag_name' do + RSpec.describe '#tag_name' do subject { super().tag_name } it { is_expected.to eq 'span' } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('status_tag') } end @@ -26,22 +26,22 @@ def status_tag(*args) context "when status is 'completed'" do subject { status_tag('completed') } - describe '#tag_name' do + RSpec.describe '#tag_name' do subject { super().tag_name } it { is_expected.to eq 'span' } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('status_tag') } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('completed') } end - describe '#content' do + RSpec.describe '#content' do subject { super().content } it { is_expected.to eq 'Completed' } end @@ -50,12 +50,12 @@ def status_tag(*args) context "when status is 'in_progress'" do subject { status_tag('in_progress') } - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('in_progress') } end - describe '#content' do + RSpec.describe '#content' do subject { super().content } it { is_expected.to eq 'In Progress' } end @@ -64,12 +64,12 @@ def status_tag(*args) context "when status is 'In progress'" do subject { status_tag('In progress') } - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('in_progress') } end - describe '#content' do + RSpec.describe '#content' do subject { super().content } it { is_expected.to eq 'In Progress' } end @@ -78,12 +78,12 @@ def status_tag(*args) context "when status is an empty string" do subject { status_tag('') } - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('status_tag') } end - describe '#content' do + RSpec.describe '#content' do subject { super().content } it { is_expected.to eq '' } end @@ -92,12 +92,12 @@ def status_tag(*args) context "when status is 'false'" do subject { status_tag('false') } - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('status_tag') } end - describe '#content' do + RSpec.describe '#content' do subject { super().content } it { is_expected.to eq('No') } end @@ -106,12 +106,12 @@ def status_tag(*args) context "when status is false" do subject { status_tag(false) } - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('status_tag') } end - describe '#content' do + RSpec.describe '#content' do subject { super().content } it { is_expected.to eq('No') } end @@ -120,12 +120,12 @@ def status_tag(*args) context "when status is nil" do subject { status_tag(nil) } - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('status_tag') } end - describe '#content' do + RSpec.describe '#content' do subject { super().content } it { is_expected.to eq('No') } end @@ -134,17 +134,17 @@ def status_tag(*args) context "when status is 'Active' and type is :ok" do subject { status_tag('Active', :ok) } - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('status_tag') } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('active') } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('ok') } end @@ -153,17 +153,17 @@ def status_tag(*args) context "when status is 'Active' and class is 'ok'" do subject { status_tag('Active', class: 'ok') } - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('status_tag') } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('active') } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('ok') } end @@ -172,22 +172,22 @@ def status_tag(*args) context "when status is 'Active' and label is 'on'" do subject { status_tag('Active', label: 'on') } - describe '#content' do + RSpec.describe '#content' do subject { super().content } it { is_expected.to eq 'on' } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('status_tag') } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('active') } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.not_to include('on') } end @@ -196,37 +196,37 @@ def status_tag(*args) context "when status is 'So useless', type is :ok, class is 'woot awesome' and id is 'useless'" do subject { status_tag('So useless', :ok, class: 'woot awesome', id: 'useless') } - describe '#content' do + RSpec.describe '#content' do subject { super().content } it { is_expected.to eq 'So Useless' } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('status_tag') } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('ok') } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('so_useless') } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('woot') } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.to include('awesome') } end - describe '#id' do + RSpec.describe '#id' do subject { super().id } it { is_expected.to eq 'useless' } end @@ -235,12 +235,12 @@ def status_tag(*args) context "when status is set to a Fixnum" do subject { status_tag(42) } - describe '#content' do + RSpec.describe '#content' do subject { super().content } it { is_expected.to eq '42' } end - describe '#class_list' do + RSpec.describe '#class_list' do subject { super().class_list } it { is_expected.not_to include('42') } end diff --git a/spec/unit/views/components/table_for_spec.rb b/spec/unit/views/components/table_for_spec.rb index d1cabfaf688..60006d4496f 100644 --- a/spec/unit/views/components/table_for_spec.rb +++ b/spec/unit/views/components/table_for_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -describe ActiveAdmin::Views::TableFor do - describe "creating with the dsl" do +RSpec.describe ActiveAdmin::Views::TableFor do + RSpec.describe "creating with the dsl" do let(:collection) do [ @@ -354,7 +354,7 @@ end end - describe "column sorting" do + RSpec.describe "column sorting" do def build_column(*args, &block) ActiveAdmin::Views::TableFor::Column.new(*args, &block) end @@ -365,7 +365,7 @@ def build_column(*args, &block) let(:table_column){ build_column(:username) } it { is_expected.to be_sortable } - describe '#sort_key' do + RSpec.describe '#sort_key' do subject { super().sort_key } it{ is_expected.to eq("username") } end @@ -380,7 +380,7 @@ def build_column(*args, &block) let(:table_column){ build_column("Username", sortable: :username){ } } it { is_expected.to be_sortable } - describe '#sort_key' do + RSpec.describe '#sort_key' do subject { super().sort_key } it{ is_expected.to eq("username") } end @@ -395,7 +395,7 @@ def build_column(*args, &block) let(:table_column){ build_column('Username column', :username) } it { is_expected.to be_sortable } - describe '#sort_key' do + RSpec.describe '#sort_key' do subject { super().sort_key } it { is_expected.to eq 'username' } end @@ -405,7 +405,7 @@ def build_column(*args, &block) let(:table_column){ build_column('Username column', :username, sortable: true) } it { is_expected.to be_sortable } - describe '#sort_key' do + RSpec.describe '#sort_key' do subject { super().sort_key } it { is_expected.to eq 'username' } end diff --git a/spec/unit/views/components/tabs_spec.rb b/spec/unit/views/components/tabs_spec.rb index 8329412ca66..dcaacfe185b 100644 --- a/spec/unit/views/components/tabs_spec.rb +++ b/spec/unit/views/components/tabs_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -describe ActiveAdmin::Views::Tabs do - describe "creating with the dsl" do +RSpec.describe ActiveAdmin::Views::Tabs do + RSpec.describe "creating with the dsl" do context "when creating tabs with a symbol" do let(:tabs) do render_arbre_component do diff --git a/spec/unit/views/components/unsupported_browser_spec.rb b/spec/unit/views/components/unsupported_browser_spec.rb index 1af3c129d2d..feceea69d21 100644 --- a/spec/unit/views/components/unsupported_browser_spec.rb +++ b/spec/unit/views/components/unsupported_browser_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Views::UnsupportedBrowser do +RSpec.describe ActiveAdmin::Views::UnsupportedBrowser do let(:helpers){ mock_action_view } let(:namespace) { double :namespace, unsupported_browser_matcher: /MSIE [1-8]\.0/ } let(:component) { double :unsupported_browser_component } @@ -18,7 +18,7 @@ def build_panel expect(build_panel.content.gsub(/\s+/, "")).to eq "

headline

recommendation

turn_off_compatibility_view

" end - describe "ActiveAdmin::Views::Pages::Base behavior" do + RSpec.describe "ActiveAdmin::Views::Pages::Base behavior" do context "when the reqex match" do it "should build the unsupported browser panel" do expect(base).to receive(:active_admin_namespace).and_return(namespace) diff --git a/spec/unit/views/index_as_blog_spec.rb b/spec/unit/views/index_as_blog_spec.rb index 6a001f6397c..71a09b796c4 100644 --- a/spec/unit/views/index_as_blog_spec.rb +++ b/spec/unit/views/index_as_blog_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' include ActiveAdmin -describe ActiveAdmin::Views::IndexAsBlog do - subject { described_class.new } +RSpec.describe ActiveAdmin::Views::IndexAsBlog do + subject { RSpec.described_class.new } - describe '#build' do + RSpec.describe '#build' do let(:page_presenter) { double('page_presenter', block: nil) } let(:collection) { double('collection') } @@ -41,7 +41,7 @@ end %w(title body).each do |method| - describe "#{method}" do + RSpec.describe "#{method}" do context 'when block given' do let(:block_result) { double('block_result') } @@ -70,7 +70,7 @@ end end - describe '.index_name' do - it { expect(described_class.index_name).to eq('blog') } + RSpec.describe '.index_name' do + it { expect(RSpec.described_class.index_name).to eq('blog') } end end diff --git a/spec/unit/views/pages/form_spec.rb b/spec/unit/views/pages/form_spec.rb index 57c4cdc48fe..ed73cf9d2d9 100644 --- a/spec/unit/views/pages/form_spec.rb +++ b/spec/unit/views/pages/form_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -describe ActiveAdmin::Views::Pages::Form do - describe "#title" do +RSpec.describe ActiveAdmin::Views::Pages::Form do + RSpec.describe "#title" do let!(:application){ ActiveAdmin::Application.new } let(:namespace){ ActiveAdmin::Namespace.new(application, "Admin") } let!(:params){ { controller: "UsersController", action: "edit" } } diff --git a/spec/unit/views/pages/index_spec.rb b/spec/unit/views/pages/index_spec.rb index 041344ae545..930e615860e 100644 --- a/spec/unit/views/pages/index_spec.rb +++ b/spec/unit/views/pages/index_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' -describe ActiveAdmin::Views::Pages::Index do - describe "#title" do +RSpec.describe ActiveAdmin::Views::Pages::Index do + RSpec.describe "#title" do let!(:application){ ActiveAdmin::Application.new } let(:namespace){ ActiveAdmin::Namespace.new(application, "Admin") } let!(:params){ { controller: "UsersController", action: "edit" } } diff --git a/spec/unit/views/pages/layout_spec.rb b/spec/unit/views/pages/layout_spec.rb index 1b742d61a2e..fc66d7bb681 100644 --- a/spec/unit/views/pages/layout_spec.rb +++ b/spec/unit/views/pages/layout_spec.rb @@ -1,6 +1,6 @@ require 'rails_helper' -describe ActiveAdmin::Views::Pages::Layout do +RSpec.describe ActiveAdmin::Views::Pages::Layout do let(:assigns){ {} } let(:helpers) do @@ -44,7 +44,7 @@ expect(layout.title).to eq "Edit" end - describe "the body" do + RSpec.describe "the body" do it "should have class 'active_admin'" do expect(layout.build.class_list).to include 'active_admin' diff --git a/spec/unit/views/pages/show_spec.rb b/spec/unit/views/pages/show_spec.rb index a55ba118eb7..92a65aa0cf3 100644 --- a/spec/unit/views/pages/show_spec.rb +++ b/spec/unit/views/pages/show_spec.rb @@ -1,8 +1,8 @@ require 'rails_helper' -describe ActiveAdmin::Views::Pages::Show do +RSpec.describe ActiveAdmin::Views::Pages::Show do - describe "the resource" do + RSpec.describe "the resource" do let(:helpers) { double resource: resource } let(:arbre_context) { Arbre::Context.new({}, helpers) } subject(:page) { ActiveAdmin::Views::Pages::Show.new(arbre_context) } diff --git a/spec/unit/views/tabbed_navigation_spec.rb b/spec/unit/views/tabbed_navigation_spec.rb index e52556fbd08..556fd48917e 100644 --- a/spec/unit/views/tabbed_navigation_spec.rb +++ b/spec/unit/views/tabbed_navigation_spec.rb @@ -1,7 +1,7 @@ require 'rails_helper' include ActiveAdmin -describe ActiveAdmin::Views::TabbedNavigation do +RSpec.describe ActiveAdmin::Views::TabbedNavigation do let(:menu){ ActiveAdmin::Menu.new } @@ -20,7 +20,7 @@ allow(helpers).to receive(:admin_logged_in?).and_return(false) end - describe "rendering a menu" do + RSpec.describe "rendering a menu" do before do menu.add label: "Blog Posts", url: :admin_posts_path @@ -104,7 +104,7 @@ end end - describe "marking current item" do + RSpec.describe "marking current item" do it "should add the 'current' class to the li" do assigns[:current_tab] = menu["Blog Posts"] @@ -122,7 +122,7 @@ end - describe "returning the menu items to display" do + RSpec.describe "returning the menu items to display" do it "should return one item with no if block" do menu.add label: "Hello World", url: "/"