Sha256: d76e77d6e037eb65c002a678e8a1ccf7a1768ed0f9b34fe9c7867d8f7c4a4650
Contents?: true
Size: 988 Bytes
Versions: 4
Compression:
Stored size: 988 Bytes
Contents
# encoding: utf-8 # Definitions for testing compound policies def valid_policy double validate!: nil, validate: double(valid?: true, invalid?: false) end def invalid_policy double validate!: nil, validate: double(valid?: false, invalid?: true) end shared_examples "creating a node" do it { is_expected.to be_kind_of Attestor::Policy::Node } end # shared examples shared_examples "creating an immutable object" do it "[freezes a policy]" do expect(subject).to be_frozen end end # shared examples shared_examples "failing validation" do it "[raises exception]" do expect { subject.validate! }.to raise_error Attestor::InvalidError end it "[adds itself to exception]" do begin subject.validate! rescue => error expect(error.object).to eq subject end end end # shared examples shared_examples "passing validation" do it "[raises exception]" do expect { subject.validate! }.not_to raise_error end end # shared examples
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
attestor-2.2.1 | spec/support/policies.rb |
attestor-2.2.0 | spec/support/policies.rb |
attestor-2.1.0 | spec/support/policies.rb |
attestor-2.0.0 | spec/support/policies.rb |