Sha256: b1f6ca1efd6b49ff4a9571a5b3b31f6bdfda6ae8c659f74f6149fb16ee55eaa5
Contents?: true
Size: 1.04 KB
Versions: 11
Compression:
Stored size: 1.04 KB
Contents
require "test_helper" class OperationBuilderTest < MiniTest::Spec class ParentOperation < Trailblazer::Operation def process(params) end class Sub < self end builds do |params| Sub if params[:sub] end end it { ParentOperation.run({}).last.class.must_equal ParentOperation } it { ParentOperation.run({sub: true}).last.class.must_equal ParentOperation::Sub } it { ParentOperation.({}).class.must_equal ParentOperation } it { ParentOperation.({sub: true}).class.must_equal ParentOperation::Sub } end class OperationBuilderClassTest < MiniTest::Spec class SuperOperation < Trailblazer::Operation builds do |params| self::Sub if params[:sub] # Sub is defined in ParentOperation. end end class ParentOperation < Trailblazer::Operation def process(params) end class Sub < self end self.builder_class = SuperOperation.builder_class end it { ParentOperation.({}).class.must_equal ParentOperation } it { ParentOperation.({sub: true}).class.must_equal ParentOperation::Sub } end
Version data entries
11 entries across 11 versions & 1 rubygems