Skip to content

Commit

Permalink
Merge pull request #3163 from olleolleolle/rspec-zero-monkey-patch-mode
Browse files Browse the repository at this point in the history
[refactor] Configure and use the zero-monkey-paching-mode in RSpec
  • Loading branch information
mshibuya authored Jul 13, 2019
2 parents 386a7d4 + 2e05f3c commit 9c668e9
Show file tree
Hide file tree
Showing 107 changed files with 108 additions and 106 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe RailsAdmin::ApplicationController, type: :controller do
RSpec.describe RailsAdmin::ApplicationController, type: :controller do
describe '#to_model_name' do
it 'works with modules' do
expect(controller.to_model_name('conversations~conversation')).to eq('Conversations::Conversation')
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/rails_admin/main_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# encoding: utf-8
require 'spec_helper'

describe RailsAdmin::MainController, type: :controller do
RSpec.describe RailsAdmin::MainController, type: :controller do
routes { RailsAdmin::Engine.routes }

def get(action, params)
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/rails_admin/application_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe RailsAdmin::ApplicationHelper, type: :helper do
RSpec.describe RailsAdmin::ApplicationHelper, type: :helper do
describe '#authorized?' do
let(:abstract_model) { RailsAdmin.config(FieldTest).abstract_model }

Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/rails_admin/form_builder_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'RailsAdmin::FormBuilder', type: :helper do
RSpec.describe 'RailsAdmin::FormBuilder', type: :helper do
describe '#generate' do
before do
allow(helper).to receive(:authorized?).and_return(true)
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers/rails_admin/main_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe RailsAdmin::MainHelper, type: :helper do
RSpec.describe RailsAdmin::MainHelper, type: :helper do
describe '#rails_admin_form_for' do
let(:html_form) do
helper.rails_admin_form_for(FieldTest.new, url: new_path(model_name: 'field_test')) {}
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/actions/base_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Base action', type: :request do
RSpec.describe 'Base action', type: :request do
subject { page }

describe '#enabled?' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/actions/bulk_delete_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'BulkDelete action', type: :request do
RSpec.describe 'BulkDelete action', type: :request do
subject { page }

describe 'confirmation page' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/actions/dashboard_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Dashboard action', type: :request do
RSpec.describe 'Dashboard action', type: :request do
subject { page }

it 'shows statistics by default' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/actions/delete_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Delete action', type: :request do
RSpec.describe 'Delete action', type: :request do
subject { page }

it "shows \"Delete model\"" do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/actions/edit_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Edit action', type: :request do
RSpec.describe 'Edit action', type: :request do
subject { page }

describe 'page' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/actions/export_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'csv'

describe 'Export action', type: :request do
RSpec.describe 'Export action', type: :request do
subject { page }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/actions/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'spec_helper'

describe 'Index action', type: :request do
RSpec.describe 'Index action', type: :request do
subject { page }

describe 'page' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/actions/new_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'New action', type: :request do
RSpec.describe 'New action', type: :request do
subject { page }

describe 'page' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/actions/show_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Show action', type: :request do
RSpec.describe 'Show action', type: :request do
subject { page }
let(:team) { FactoryBot.create :team }

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/authorization/cancan_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'RailsAdmin CanCan Authorization', type: :request do
RSpec.describe 'RailsAdmin CanCan Authorization', type: :request do
class Ability
include CanCan::Ability
def initialize(user)
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/authorization/cancancan_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'RailsAdmin CanCanCan Authorization', type: :request do
RSpec.describe 'RailsAdmin CanCanCan Authorization', type: :request do
class Ability
include CanCan::Ability
def initialize(user)
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/authorization/pundit_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'RailsAdmin Pundit Authorization', type: :request do
RSpec.describe 'RailsAdmin Pundit Authorization', type: :request do
subject { page }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/action_text_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'ActionText field', type: :request do
RSpec.describe 'ActionText field', type: :request do
subject { page }

it 'works without error', js: true do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/active_record_enum_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'ActiveRecordEnum field', type: :request, active_record: true do
RSpec.describe 'ActiveRecordEnum field', type: :request, active_record: true do
subject { page }

describe 'for string-keyed enum' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/base_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Base field', type: :request do
RSpec.describe 'Base field', type: :request do
subject { page }

describe '#default_value' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/belongs_to_association_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'BelongsToAssociation field', type: :request do
RSpec.describe 'BelongsToAssociation field', type: :request do
subject { page }

describe 'with inverse_of option' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/ck_editor_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'CKEditor field', type: :request do
RSpec.describe 'CKEditor field', type: :request do
subject { page }

it 'works without error', js: true do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/code_mirror_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'CodeMirror field', type: :request do
RSpec.describe 'CodeMirror field', type: :request do
subject { page }

it 'works without error', js: true do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/color_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Color field', type: :request do
RSpec.describe 'Color field', type: :request do
subject { page }

it 'shows input with class color' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/enum_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Enum field', type: :request, active_record: true do
RSpec.describe 'Enum field', type: :request, active_record: true do
subject { page }

describe "when object responds to '\#{method}_enum'" do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/floara_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Floara field', type: :request do
RSpec.describe 'Floara field', type: :request do
subject { page }

it 'works without error', js: true do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'HasAndBelongsToManyAssociation field', type: :request do
RSpec.describe 'HasAndBelongsToManyAssociation field', type: :request do
subject { page }

context 'on create' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/has_many_association_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'HasManyAssociation field', type: :request do
RSpec.describe 'HasManyAssociation field', type: :request do
subject { page }

context 'when an association is readonly' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/has_one_assosiation_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'HasOneAssociation field', type: :request do
RSpec.describe 'HasOneAssociation field', type: :request do
subject { page }

describe 'with inverse_of option' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/hidden_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Hidden field', type: :request do
RSpec.describe 'Hidden field', type: :request do
subject { page }

describe '#default_value' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/multiple_carrierwave_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'MultipleCarrierwave field', type: :request, active_record: true do
RSpec.describe 'MultipleCarrierwave field', type: :request, active_record: true do
subject { page }
before do
RailsAdmin.config FieldTest do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/paperclip_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Paperclip field', type: :request do
RSpec.describe 'Paperclip field', type: :request do
subject { page }

it 'shows a file upload field' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/polymorphic_assosiation_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'PolymorphicAssociation field', type: :request do
RSpec.describe 'PolymorphicAssociation field', type: :request do
subject { page }

context 'on create' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/serialized_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Serialized field', type: :request do
RSpec.describe 'Serialized field', type: :request do
subject { page }

context 'with serialized objects' do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/simple_mde_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'SimpleMDE field', type: :request do
RSpec.describe 'SimpleMDE field', type: :request do
subject { page }

it 'works without error', js: true do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/fields/wysihtml5_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'Wysihtml5 field', type: :request do
RSpec.describe 'Wysihtml5 field', type: :request do
subject { page }

it 'works without error', js: true do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/history/rails_admin_history_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'RailsAdmin History', type: :request, active_record: true do
RSpec.describe 'RailsAdmin History', type: :request, active_record: true do
describe 'model history fetch' do
before :each do
RailsAdmin::History.delete_all
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/history/rails_admin_paper_trail_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'paper_trail/frameworks/rspec' if defined?(PaperTrail)

describe 'RailsAdmin PaperTrail history', active_record: true do
RSpec.describe 'RailsAdmin PaperTrail history', active_record: true do
before(:each) do
skip 'Requires Ruby >= 2.3' if Rails::VERSION::STRING >= '5.2' && RUBY_VERSION =~ /^2\.2/
RailsAdmin.config do |config|
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/rails_admin_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe RailsAdmin, type: :request do
RSpec.describe RailsAdmin, type: :request do
subject { page }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/widgets/filtering_multi_select_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'FilteringMultiSelect widget', type: :request, js: true do
RSpec.describe 'FilteringMultiSelect widget', type: :request, js: true do
subject { page }

describe 'Choose all button' do
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_admin/abstract_model_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe RailsAdmin::AbstractModel do
RSpec.describe RailsAdmin::AbstractModel do
describe '.all' do
it 'returns abstract models for all models' do
expect(RailsAdmin::AbstractModel.all.map(&:model)).to include Player, Team
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_admin/active_record_extension_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require File.expand_path('../../../config/initializers/active_record_extensions', __FILE__)

describe 'ActiveRecord::Base', active_record: true do
RSpec.describe 'ActiveRecord::Base', active_record: true do
describe '#safe_send' do
it 'only calls #read_attribute once' do
@player = Player.new
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'RailsAdmin::Adapters::ActiveRecord::AbstractObject', active_record: true do
RSpec.describe 'RailsAdmin::Adapters::ActiveRecord::AbstractObject', active_record: true do
describe 'proxy' do
let(:object) { double('object') }
let(:abstract_object) { RailsAdmin::Adapters::ActiveRecord::AbstractObject.new(object) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'timecop'

describe 'RailsAdmin::Adapters::ActiveRecord::Association', active_record: true do
RSpec.describe 'RailsAdmin::Adapters::ActiveRecord::Association', active_record: true do
before :all do
RailsAdmin::AbstractModel.reset_polymorphic_parents

Expand Down
2 changes: 1 addition & 1 deletion spec/rails_admin/adapters/active_record/property_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'timecop'

describe 'RailsAdmin::Adapters::ActiveRecord::Property', active_record: true do
RSpec.describe 'RailsAdmin::Adapters::ActiveRecord::Property', active_record: true do
describe 'string field' do
subject { RailsAdmin::AbstractModel.new('Player').properties.detect { |f| f.name == :name } }

Expand Down
2 changes: 1 addition & 1 deletion spec/rails_admin/adapters/active_record_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'timecop'

describe 'RailsAdmin::Adapters::ActiveRecord', active_record: true do
RSpec.describe 'RailsAdmin::Adapters::ActiveRecord', active_record: true do
let(:like) do
if ['postgresql', 'postgis'].include? ::ActiveRecord::Base.configurations[Rails.env]['adapter']
'(field ILIKE ?)'
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_admin/adapters/mongoid/abstract_object_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'rails_admin/adapters/mongoid/abstract_object'

describe 'RailsAdmin::Adapters::Mongoid::AbstractObject', mongoid: true do
RSpec.describe 'RailsAdmin::Adapters::Mongoid::AbstractObject', mongoid: true do
before do
@players = FactoryBot.create_list :player, 3
@draft = FactoryBot.create :draft
Expand Down
2 changes: 1 addition & 1 deletion spec/rails_admin/adapters/mongoid/association_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'RailsAdmin::Adapters::Mongoid::Association', mongoid: true do
RSpec.describe 'RailsAdmin::Adapters::Mongoid::Association', mongoid: true do
before :all do
RailsAdmin::AbstractModel.reset_polymorphic_parents

Expand Down
Loading

0 comments on commit 9c668e9

Please sign in to comment.