Sha256: 399428d37d6b0ffb5cec58857488264a145afedd3e63e111b62e7285d69a5861
Contents?: true
Size: 827 Bytes
Versions: 7
Compression:
Stored size: 827 Bytes
Contents
RSpec.describe Tram::Policy::ValidationError do subject(:error) { described_class.new policy, filter } let(:one) { double message: "OMG!", level: "error" } let(:two) { double message: "phew!", level: "warning" } let(:policy) { double :policy, errors: [one, two] } shared_examples :exception_with_messages do |text| it { is_expected.to be_a RuntimeError } its(:policy) { is_expected.to eq policy } its(:message) { is_expected.to eq "Validation failed with errors:#{text}" } end context "with a liberal filter" do let(:filter) { proc { false } } it_behaves_like :exception_with_messages, "\n- OMG!\n- phew!" end context "with a restricting filter" do let(:filter) { proc { |error| error.level != "error" } } it_behaves_like :exception_with_messages, "\n- OMG!" end end
Version data entries
7 entries across 7 versions & 1 rubygems