Sha256: 42cb9da55291e9fa44d9e9c3590fc9745729f7166f78d45faddda69be1547d56

Contents?: true

Size: 905 Bytes

Versions: 14

Compression:

Stored size: 905 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

14 entries across 14 versions & 1 rubygems

Version Path
finapps_core-2.0.20 spec/utils/validatable_spec.rb
finapps_core-2.0.19 spec/utils/validatable_spec.rb
finapps_core-2.0.18 spec/utils/validatable_spec.rb
finapps_core-2.0.17 spec/utils/validatable_spec.rb
finapps_core-2.0.16 spec/utils/validatable_spec.rb
finapps_core-2.0.15 spec/utils/validatable_spec.rb
finapps_core-2.0.14 spec/utils/validatable_spec.rb
finapps_core-2.0.13 spec/utils/validatable_spec.rb
finapps_core-2.0.12 spec/utils/validatable_spec.rb
finapps_core-2.0.11 spec/utils/validatable_spec.rb
finapps_core-2.0.10 spec/utils/validatable_spec.rb
finapps_core-2.0.9 spec/utils/validatable_spec.rb
finapps_core-2.0.8 spec/utils/validatable_spec.rb
finapps_core-2.0.7 spec/utils/validatable_spec.rb