test/operation_test.rb in trailblazer-operation-0.7.3 vs test/operation_test.rb in trailblazer-operation-0.7.4
- old
+ new
@@ -1,7 +1,29 @@
require "test_helper"
class DeclarativeApiTest < Minitest::Spec
+ it "doesn't invoke {call} twice when using public interface" do
+ class MyOp < Trailblazer::Operation
+ @@GLOBAL = []
+ def self.global; @@GLOBAL; end
+
+
+ def self.call(*args)
+ @@GLOBAL << :call
+ super
+ end
+
+ pass :model
+
+ def model(ctx, **)
+ @@GLOBAL << :model
+ end
+ end
+
+ MyOp.({})
+ MyOp.global.inspect.must_equal %{[:call, :model]}
+ end
+
#---
#- step, pass, fail
# Test: step/pass/fail
# * do they deviate properly?