Sha256: 4806026bd8584f1315137b27a2a80290a8bbed56fbb75eaa8719415494b33541
Contents?: true
Size: 664 Bytes
Versions: 1
Compression:
Stored size: 664 Bytes
Contents
require "spec_helper" module Contracts RSpec.describe "range contract validator" do subject(:o) { GenericExample.new } it "passes when value is in range" do expect do o.method_with_range_contract(5) end.not_to raise_error(ContractError) end it "fails when value is not in range" do expect do o.method_with_range_contract(300) end.to raise_error(ContractError, /Expected: 1\.\.10/) end it "fails when value is incorrect" do expect do o.method_with_range_contract("hello world") end.to raise_error(ContractError, /Expected: 1\.\.10.*Actual: "hello world"/m) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
contracts-0.11.0 | spec/validators_spec.rb |