Sha256: e519fc111cdc6cc1b9379f21ce1a6841bc5bff12814aa3880fe6a2c8c8df193f

Contents?: true

Size: 683 Bytes

Versions: 8

Compression:

Stored size: 683 Bytes

Contents

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

describe "method_missing" do
  include MySpecHelper
  before do
    make_pristine_class('Klass')
    Klass.state_fu_machine() {}
    @obj = Klass.new
  end

  it "should revert to the original method_missing after it is called once" do
    mock.proxy( @obj ).state_fu!.times(1)
    mm1 = @obj.method(:method_missing)
    call_snafu = lambda do
      begin
        @obj.snafu!
      rescue NoMethodError
      end
    end
    call_snafu.call()
    mm2 = @obj.method(:method_missing)
    mm1.should_not == mm2
    call_snafu.call()
    mm3 = @obj.method(:method_missing)
    mm3.should == mm2
    # @obj.snafu
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
davidlee-state-fu-0.10.0 spec/features/method_missing_only_once_spec.rb
davidlee-state-fu-0.11.0 spec/features/method_missing_only_once_spec.rb
davidlee-state-fu-0.11.1 spec/features/method_missing_only_once_spec.rb
davidlee-state-fu-0.12.0 spec/features/method_missing_only_once_spec.rb
davidlee-state-fu-0.12.1 spec/features/method_missing_only_once_spec.rb
state-fu-0.12.3 spec/features/method_missing_only_once_spec.rb
state-fu-0.12.1 spec/features/method_missing_only_once_spec.rb
state-fu-0.11.1 spec/features/method_missing_only_once_spec.rb