Sha256: e92184ba8a23e1d336046bc0a68a9f4777fecd6c073b3867410ffd161fb355a8

Contents?: true

Size: 502 Bytes

Versions: 4

Compression:

Stored size: 502 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.25.0 spec/rubocop/cop/rails/validation_spec.rb
rubocop-0.24.1 spec/rubocop/cop/rails/validation_spec.rb
rubocop-0.24.0 spec/rubocop/cop/rails/validation_spec.rb
rubocop-0.23.0 spec/rubocop/cop/rails/validation_spec.rb