Digdagで実行するRubyのTaskのテスト書きたい時に使うDigdagのMock

October 27, 2018 by Yudai Suzuki

class Digdag
  STORE_PARAMS = {}

  def self.env
    self
  end

  def self.store(params)
    STORE_PARAMS.merge!(params.transform_keys(&:to_s))
  end

  def self.params
    STORE_PARAMS
  end
end

Digdag.env.store(foo: 'bar') #=> {"foo"=>"bar"}
Digdag.env.params['foo']     #=> "bar"

© 2017 | Onigra | Powerd by Hucore theme & Hugo