Sha256: 8c6d23fcdf5fe4b8d17fcba43f73529d0afe3e6080bff850c357388c712cfe73

Contents?: true

Size: 1019 Bytes

Versions: 6

Compression:

Stored size: 1019 Bytes

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
          configs["railsbp.include_forbidden_attributes_protection"].should == "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
          configs["railsbp.include_forbidden_attributes_protection"].should be_nil
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_best_practices-1.14.4 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.14.3 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.14.2 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.14.1 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.14.0 spec/rails_best_practices/prepares/initializer_prepare_spec.rb
rails_best_practices-1.13.8 spec/rails_best_practices/prepares/initializer_prepare_spec.rb