Sha256: f28e9e5c0e0d7536f4dc9d1aed172b5c9cd39297a51b35dd325e8f338dfdf524

Contents?: true

Size: 746 Bytes

Versions: 25

Compression:

Stored size: 746 Bytes

Contents

module Fakes
  module ArgBehaviour
    attr_accessor :return_value,:times_called,:arg_matcher

    def initialize_matcher_using(args)
      @arg_matcher = ArgMatchFactory.create_arg_matcher_using(args)
    end

    def and_return(item)
      @return_value = item
    end

    def throws(exception)
      @exception = exception
    end

    def capture_args(args)
      @times_called += 1
      @called_args = args
    end

    def matches?(args)
      return @arg_matcher.matches?(args)
    end

    def was_called_with?(args)
      ArgMatchFactory.create_arg_matcher_using(args).matches?(@called_args)
    end

    def process
      return @return_value unless @exception
      if @exception
        raise @exception
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
fakes-1.1.4 lib/fakes/arg_behaviour.rb
fakes-1.1.3 lib/fakes/arg_behaviour.rb
fakes-1.1.2 lib/fakes/arg_behaviour.rb
fakes-1.0.31 lib/core/arg_behaviour.rb
fakes-1.0.30 lib/core/arg_behaviour.rb
fakes-1.0.25 lib/core/arg_behaviour.rb
fakes-1.1.1 lib/fakes/arg_behaviour.rb
fakes-1.0.24 lib/core/arg_behaviour.rb
fakes-1.0.22 lib/core/arg_behaviour.rb
fakes-1.1.0 lib/fakes/arg_behaviour.rb
fakes-1.0.9 lib/fakes/arg_behaviour.rb
fakes-1.0.8 lib/fakes/arg_behaviour.rb
fakes-1.0.7 lib/fakes/arg_behaviour.rb
fakes-1.0.6 lib/fakes/arg_behaviour.rb
fakes-1.0.5 lib/core/arg_behaviour.rb
fakes-1.0.2 lib/core/arg_behaviour.rb
fakes-1.0.1 lib/core/arg_behaviour.rb
fakes-1.0.0 lib/core/arg_behaviour.rb
fakes-0.4.1 lib/core/arg_behaviour.rb
fakes-0.4.0 lib/core/arg_behaviour.rb