lib/hanami/interactor.rb in hanami-utils-1.0.0.beta3 vs lib/hanami/interactor.rb in hanami-utils-1.0.0.rc1
- old
+ new
@@ -19,11 +19,10 @@
# @see Hanami::Interactor::Result#respond_to_missing?
METHODS = ::Hash[initialize: true,
success?: true,
successful?: true,
failure?: true,
- failing?: true,
fail!: true,
prepare!: true,
errors: true,
error: true].freeze
@@ -209,16 +208,16 @@
# @user = User.new(@params)
# @foo = 'bar'
# end
#
# def call
- # @user = UserRepository.persist(@user)
+ # @user = UserRepository.new.persist(@user)
# end
# end
#
# result = Signup.new(name: 'Luca').call
- # result.failing? # => false
+ # result.failure? # => false
# result.successful? # => true
#
# result.user # => #<User:0x007fa311105778 @id=1 @name="Luca">
# result.params # => { :name=>"Luca" }
# result.foo # => raises NoMethodError
@@ -235,22 +234,22 @@
# @user = User.new(@params)
# end
#
# # THIS WON'T BE INVOKED BECAUSE #valid? WILL RETURN false
# def call
- # @user = UserRepository.persist(@user)
+ # @user = UserRepository.new.persist(@user)
# end
#
# private
# def valid?
# @params.valid?
# end
# end
#
# result = Signup.new(name: nil).call
# result.successful? # => false
- # result.failing? # => true
+ # result.failure? # => true
#
# result.user # => #<User:0x007fa311105778 @id=nil @name="Luca">
#
# @example Bad usage
# require 'hanami/interactor'
@@ -301,10 +300,10 @@
# capture_screenshot!
# end
#
# private
# def persist_email_test!
- # @email_test = EmailTestRepository.persist(@email_test)
+ # @email_test = EmailTestRepository.new.persist(@email_test)
# end
#
# # IF THIS RAISES AN EXCEPTION WE FORCE A FAILURE
# def capture_screenshot!
# Screenshot.new(@email_test).capture!