Sha256: 1aabc40e9de5ca6eb08f11c392d597abcbfc4567f5e12d2a82cb1d502c5407f7

Contents?: true

Size: 481 Bytes

Versions: 8

Compression:

Stored size: 481 Bytes

Contents

module Bogus
  class InteractionPresenter
    extend Takes

    takes :interaction

    def to_s
      "##{interaction.method}(#{args})#{result}"
    end

    private

    def args
      interaction.args.map(&:inspect).join(', ')
    end

    def result
      error || return_value
    end

    def return_value
      " => #{interaction.return_value.inspect}" if interaction.has_result
    end

    def error
      " !! #{interaction.error}" if interaction.error
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bogus-0.1.7 lib/bogus/stubbing/interaction_presenter.rb
bogus-0.1.6 lib/bogus/stubbing/interaction_presenter.rb
bogus-0.1.5 lib/bogus/stubbing/interaction_presenter.rb
bogus-0.1.4 lib/bogus/stubbing/interaction_presenter.rb
bogus-0.1.3 lib/bogus/interaction_presenter.rb
bogus-0.1.2 lib/bogus/interaction_presenter.rb
bogus-0.1.1 lib/bogus/interaction_presenter.rb
bogus-0.1.0 lib/bogus/interaction_presenter.rb