spec/tram/policy/errors_spec.rb in tram-policy-0.0.2 vs spec/tram/policy/errors_spec.rb in tram-policy-0.0.3

- old
+ new

@@ -21,9 +21,21 @@ expect(error).to be_kind_of Tram::Policy::Error expect(error).to eq message: "OMG!", level: "info", field: "name" end end + describe "#empty?" do + subject { errors.add :omg, level: "info", field: "name" } + + it "checks whether error present" do + expect(subject).not_to be_empty + end + + it "accepts a block" do + expect(subject.empty? { |error| error.level != "info" }).to eq true + end + end + describe "#merge" do let(:other) { described_class.new(policy) } before do errors.add "D'OH!", level: "disaster"