Sha256: 2f22fd1ca0130770033c4d20bccd70f2e0c8d954e50497388be58394eed5cacd

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../helper")

class Moo
  def arity_1( a )
    raise "!"
  end

  def arity_0( )
    raise "!"
  end
end

describe "sanity check: rr / arity" do
  it "should have the expected arity for standard methods" do
    m = Moo.new()
    m.method(:arity_1).arity.should == 1
    m.method(:arity_0).arity.should == 0
  end

  it "should have the expected arity when methods are mocked" do
    m = Moo.new()
    a1 = Object.new
    a0 = Object.new
    stub( a1 ).arity() { 1 }
    stub( a0 ).arity() { 0 }
    stub( m ).method(:arity_1) { a1 }
    stub( m ).method(:arity_0) { a0 }
    m.method(:arity_1).arity.should == 1
    m.method(:arity_0).arity.should == 0
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
davidlee-state-fu-0.0.1 spec/integration/sanity_spec.rb
davidlee-state-fu-0.0.2 spec/integration/sanity_spec.rb
davidlee-state-fu-0.2.0 spec/integration/sanity_spec.rb
davidlee-state-fu-0.3.1 spec/integration/sanity_spec.rb