Sha256: e1cb4a225f58065598f40e8cd60fe2563495973568df0e2f440dbcf355263b6b

Contents?: true

Size: 859 Bytes

Versions: 4

Compression:

Stored size: 859 Bytes

Contents

require 'spec_helper'

RSpec.describe PolishGeeks::DevTools::Validators::Base do
  let(:output) { :output }
  subject { described_class.new(output) }

  describe '#new' do
    it { expect(subject.instance_variable_get(:@stored_output)).to eq output }
  end

  describe '#valid?' do
    it do
      expect { subject.valid? }.to raise_error(PolishGeeks::DevTools::Errors::NotImplementedError)
    end
  end

  describe '#validate!' do
    context 'valid? true' do
      before { expect(subject).to receive(:valid?) { true } }

      it { expect { subject.validate! }.not_to raise_error }
    end

    context 'valid? false' do
      before { expect(subject).to receive(:valid?) { false } }

      it do
        expect { subject.validate! }.to raise_error(
          PolishGeeks::DevTools::Errors::PreCommandValidationError
        )
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
polishgeeks-dev-tools-1.3.2 spec/lib/polish_geeks/dev_tools/validators/base_spec.rb
polishgeeks-dev-tools-1.3.1 spec/lib/polish_geeks/dev_tools/validators/base_spec.rb
polishgeeks-dev-tools-1.3.0 spec/lib/polish_geeks/dev_tools/validators/base_spec.rb
polishgeeks-dev-tools-1.2.1 spec/lib/polishgeeks/dev-tools/validators/base_spec.rb