Sha256: 20fe08402626a119c0dd7a191dd255ba09e21b1f269a586520aa656148b24d7a

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

module Rubocop
  module Cop
    module Rails
      describe Validation do
        subject(:cop) { described_class.new }

        Validation::BLACKLIST.each do |validation|
          it "registers an offence for #{validation}" do
            inspect_source(cop,
                           ["#{validation} :name"])
            expect(cop.offences.size).to eq(1)
          end
        end

        it 'accepts sexy validations' do
          inspect_source(cop,
                         ['validates :name'])
          expect(cop.offences).to be_empty
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubocop-0.13.1 spec/rubocop/cop/rails/validation_spec.rb
rubocop-0.13.0 spec/rubocop/cop/rails/validation_spec.rb