Sha256: 714a841263ee437044f8c04cc5f17ac4495a41835f0babcf017dce8f0883be9f

Contents?: true

Size: 1 KB

Versions: 11

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

module RailsBestPractices
  module Prepares
    describe InitializerPrepare do
      let(:runner) { Core::Runner.new(prepares: InitializerPrepare.new) }

      context "initializers" do
        it "should set include_forbidden_attributes_protection config" do
          content =<<-EOF
          class AR
            ActiveRecord::Base.send(:include, ActiveModel::ForbiddenAttributesProtection)
          end
          EOF
          runner.prepare('config/initializers/ar.rb', content)
          configs = Prepares.configs
          expect(configs["railsbp.include_forbidden_attributes_protection"]).to eq("true")
        end

        it "should not set include_forbidden_attributes_protection config" do
          content =<<-EOF
          class AR
          end
          EOF
          runner.prepare('config/initializers/ar.rb', content)
          configs = Prepares.configs
          expect(configs["railsbp.include_forbidden_attributes_protection"]).to be_nil
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rails_best_practices-1.19.0 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.18.1 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.18.0 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.17.0 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.16.0 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.15.7 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.15.6 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.15.4 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.15.3 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.15.2 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.15.1 spec/rails_best_practices/prepares/initializer_prepare_spec.rb