spec/tram/policy/rspec_spec.rb in tram-policy-1.0.0 vs spec/tram/policy/rspec_spec.rb in tram-policy-1.0.1

- old
+ new

@@ -44,6 +44,21 @@ it "fails when some error present w/o tags constraint" do expect { expect(subject).not_to be_invalid_at } .to raise_error RSpec::Expectations::ExpectationNotMetError end end + + describe "to be_invalid" do + subject { double("model") } + + it "fails with valid non-policy object" do + allow(subject).to receive(:valid?).and_return(true) + expect { expect(subject).to be_invalid } + .to raise_error RSpec::Expectations::ExpectationNotMetError + end + + it "passes with invalid non-policy object" do + allow(subject).to receive(:valid?).and_return(false) + expect { expect(subject).to be_invalid }.not_to raise_error + end + end end