Sha256: 7266885f03c4c93932f0db352f15c20924648eaccc01bf477fb5aaf91fdffdb4

Contents?: true

Size: 903 Bytes

Versions: 13

Compression:

Stored size: 903 Bytes

Contents

require "test_helper"
require "dry/container"

class DryContainerTest < Minitest::Spec
  my_container = Dry::Container.new
  my_container.register("user_repository", -> { Object })
  my_container.namespace("contract") do
    register("create") { Array }
  end

  class Create < Trailblazer::Operation
  end

  it "allows 2.2 call style" do
    Create.({}, my_container)["user_repository"].must_equal Object
  end

  it { Create.({}, {}, my_container)["user_repository"].must_equal Object }
  it { Create.({}, {}, my_container)["contract.create"].must_equal Array }
  # also allows our own options PLUS containers.
  it { Create.({}, { "model" => String }, my_container)["model"].must_equal String }
  it { Create.({}, { "model" => String }, my_container)["user_repository"].must_equal Object }
  it { Create.({}, { "user_repository" => Fixnum }, my_container)["user_repository"].must_equal Fixnum }
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
trailblazer-operation-0.4.1 test/dry_container_test.rb
trailblazer-operation-0.4.0 test/dry_container_test.rb
trailblazer-operation-0.3.1 test/dry_container_test.rb
trailblazer-operation-0.3.0 test/dry_container_test.rb
trailblazer-operation-0.2.5 test/dry_container_test.rb
trailblazer-operation-0.2.4 test/dry_container_test.rb
trailblazer-operation-0.2.3 test/dry_container_test.rb
trailblazer-operation-0.2.2 test/dry_container_test.rb
trailblazer-operation-0.2.1 test/dry_container_test.rb
trailblazer-operation-0.2.0 test/dry_container_test.rb
trailblazer-operation-0.1.3 test/dry_container_test.rb
trailblazer-operation-0.1.2 test/dry_container_test.rb
trailblazer-operation-0.1.1 test/dry_container_test.rb