These are chat archives for dry-rb/chat

28th
Mar 2018
Nico Ritschel
@nicosuave
Mar 28 2018 00:14
Thanks @timriley, I was hoping to avoid anti-patterns and was curious if anyone had composed transactions similarly. Will proceed forward :metal:
Tim Riley
@timriley
Mar 28 2018 00:19
Trasactions are just operations themselves, at the end of the day
Nico Ritschel
@nicosuave
Mar 28 2018 05:51
:)
Spencer Goh
@dymaxionuk
Mar 28 2018 12:38
@GustavoCaso sorry that class MyOp was supposed to be a dry-transaction/operation
Guilherme Moreira
@gmmoreira
Mar 28 2018 16:49
@nicosuave I have been using and they work pretty well. The interface of a transaction is the same of the operations, respond to call and return success or failure.
Alexander
@cutalion
Mar 28 2018 18:46
hey! Are there somebody who can show test setup with dry-system and stubs?
My problem is that I have a boot.rb file, which I load in tests, but it finalizes and freezes the app container, so enable_stubs! does not work after that.
Alexander
@cutalion
Mar 28 2018 19:50
for now I ended with this in my boot.rb file (which loads everything and is a entry point for the app)
if ENV['RACK_ENV'] == 'test'
  require 'dry/system/stubs'
  App.enable_stubs!
end
btw, I wrote this a long time ago:
require_relative 'app/container'
require_relative 'app/transaction'
require_relative 'app/operation'
require_relative 'app/import'

if ENV['RACK_ENV'] == 'test'
  require 'dry/system/stubs'
  App.enable_stubs!
end

App.finalize! do |container|
  # Boot the app config before everything else
  container.start :app_config
  container.start :i18n
end

require_relative 'app/api'
Alexander
@cutalion
Mar 28 2018 19:55
I remember I looked at berg app and was trying to build my own app. So, I do not remember why I require api after finalize! :smile:
app/api here defines grape application.
Can somebody else share config for dry-system/dry-web application too? Would be interesting to compare