dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
dry-bot on master
[devtools] config sync (compare)
irb(main):017:0> Testing.new(ref: nil)
TypeError: nil (NilClass) has invalid type for :ref violates constraints (type?(Integer, nil) AND filled?(nil) failed)
Hi, i have question about dynamic arguments in dry-v schema
I try to define schema
CreateSchema = Dry::Validation.Form do
configure do
option :min_time
def time_range
min_time...Time.current
end
end
required(:start_at).filled(:time?, included_in?: time_range)
end
but i have the error when use this schema
CreateSchema.with(min_time: 10.minutes.ago).call(params)
Failure/Error: min_time...Time.current
ArgumentError:
bad value for range
I think this error raised when schema compiled and option min_time at thid moment is nil. It’s right way to define schema like this with dynamic agruments?
11...Time.current
ArgumentError: bad value for range
How are we supposed to mock operations?
class MyOp
def call(inputs)
// lightweight do something
my_wrapped_op.call(stuff) do |m|
m.success do |v|
// do something
end
end
// clean up and return stuff
end
end
This however doesn't work because my_wrapped_op
should call the block with a Dry::Matcher::Evaluator - my test however shouldn't get into the internals of dry operations.
expect MyOp.to_receive(:call) {|&block| block.call( Success('something') }
Am I approaching this wrong?
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'
require “my_app/container”
, this will leave it un-finalized and allow you to add the stubs support