Sha256: ef425f0a55946207229220ee6b976362f79d37be93a43af3cac5b708184ea344

Contents?: true

Size: 502 Bytes

Versions: 8

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 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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
ridecharge-rubocop-0.0.1 spec/rubocop/cop/rails/validation_spec.rb
rubocop-0.18.1 spec/rubocop/cop/rails/validation_spec.rb
rubocop-0.18.0 spec/rubocop/cop/rails/validation_spec.rb
rubocop-0.17.0 spec/rubocop/cop/rails/validation_spec.rb
rubocop-0.16.0 spec/rubocop/cop/rails/validation_spec.rb
rubocop-0.15.0 spec/rubocop/cop/rails/validation_spec.rb
rubocop-0.14.1 spec/rubocop/cop/rails/validation_spec.rb
rubocop-0.14.0 spec/rubocop/cop/rails/validation_spec.rb