Sha256: d7d08329f32a6b893458724f5a005fb63865836d1f94c1188e5d254ace73a25f

Contents?: true

Size: 906 Bytes

Versions: 6

Compression:

Stored size: 906 Bytes

Contents

# frozen_string_literal: true

class FakeClass
  include FinAppsCore::Utils::Validatable
end

RSpec.describe FinAppsCore::Utils::Validatable do
  describe '#not_blank' do
    context 'for null values' do
      it 'should raise FinAppsCore::MissingArgumentsError' do
        expect { FakeClass.new.not_blank(nil) }.to raise_error(FinAppsCore::MissingArgumentsError,
                                                               'Missing argument')
      end

      it 'should describe the argument name when provided' do
        expect { FakeClass.new.not_blank(nil, :name) }.to raise_error(FinAppsCore::MissingArgumentsError,
                                                                      'Missing argument: name')
      end
    end

    context 'for non null values' do
      it 'should not raise' do
        expect { FakeClass.new.not_blank(true) }.not_to raise_error
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
finapps_core-3.0.6 spec/utils/validatable_spec.rb
finapps_core-3.0.5 spec/utils/validatable_spec.rb
finapps_core-3.0.3 spec/utils/validatable_spec.rb
finapps_core-3.0.1 spec/utils/validatable_spec.rb
finapps_core-2.1.2 spec/utils/validatable_spec.rb
finapps_core-2.1.1 spec/utils/validatable_spec.rb