Sha256: 044399f69753b6ca15fa4f1132d20fd36593490431fd2018db3e76e8b19611f1

Contents?: true

Size: 367 Bytes

Versions: 4

Compression:

Stored size: 367 Bytes

Contents

module Mod
  include Contracts

  Contract Num => Num
  def self.a_module_method a
    a + 1
  end
end

RSpec.describe "module methods" do
  it "should pass for correct input" do
    expect { Mod.a_module_method(2) }.to_not raise_error
  end

  it "should fail for incorrect input" do
    expect { Mod.a_module_method("bad") }.to raise_error(ContractError)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
contracts-0.10.1 spec/module_spec.rb
contracts-0.10 spec/module_spec.rb
contracts-0.9 spec/module_spec.rb
contracts-0.8 spec/module_spec.rb