Examples:
class MyFlow < Conflow::Flow
def configure(run_other: true)
run RegularJob
run OtherJob if run_other
end
end
RSpec.describe MyFlow do
subject { described_class.create(run_other: false) }
it { is_expected.to run_job(RegularJob) }
it { is_expected.to_not run_job(OtherJob) }
end
class MyFlow < Conflow::Flow
def configure(id:)
run UpdateJob, params: { id: id }
end
end
RSpec.describe MyFlow do
subject { described_class.create(id: 300) }
it { is_expected.to run_job(UpdateJob).with_params(id: 300) }
it { is_expected.to_not run_job(UpdateJob).with_params(id: 301) }
end
class MyFlow < Conflow::Flow
def configure(ids:)
ids.each { |id| run UpdateJob, params: { id: id } }
end
end
RSpec.describe MyFlow do
subject { described_class.create(ids: [300, 301]) }
it { is_expected.to run_job(UpdateJob).twice } it { is_expected.to run_job(UpdateJob).with_params(id: 300) }
it { is_expected.to run_job(UpdateJob).with_params(id: 301) }
end